Error importing a stub json file including another json file in response.bodyFile

21 views
Skip to first unread message

Krishna M

unread,
Jul 25, 2023, 8:41:05 PM7/25/23
to hoverfly
Hi 

Additional information before going through the issue: Hoverfly was not installed in my local environment. 

I have created a stub json file including another json file in response.bodyFile.

in samplestub.json
"request": {
"path": [
{
"matcher": "exact",
"value": "/hoverfly-one/v1/"
}
],
"method": [
{
"matcher": "exact",
"value": "GET"
}
],
"destination": [
{
"matcher": "exact",
"value": "one.alpha.internal"
}
],
"scheme": [
{
"matcher": "exact",
"value": "http"
}
]
},
"response": {
"status": 200,
"bodyFile": "./allBody200.json",
"encodedBody": false,
"headers": {
"Accept": [
"*/*"
],

When i try to import the above stub file using following RESTAPI, i'm getting following error. 

Directory structure 
$ pwd
/Users/user1/stubs
$ ls -la
samplestub.json
allBody200.json

Request:
$ curl -X POST -d "@samplestub.json" -k -H Content-Type\:application/json https\://hoverfly-admin.internal/api/v2/simulation

Response:
HttpCode: 500 
{"error":"An error occurred: data.pairs[0].response open allBody200.json: no such file or directory"}

From the error i understood server is trying to find allBody200.json, which is not available in hoverfly sever. It's in my local environment.  

Is it possible to import like this? any suggestions? 

Thanks,
Rama.
Reply all
Reply to author
Forward
0 new messages