Skip to content

Commit da88c33

Browse files
ns3777ktommysitu
authored andcommitted
update docs
1 parent 51dc7c2 commit da88c33

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

core/cmd/hoverfly/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ func main() {
200200
flag.Var(&destinationFlags, "dest", "Specify which hosts to process (i.e. '-dest fooservice.org -dest barservice.org -dest catservice.org') - other hosts will be ignored will passthrough'")
201201
flag.Var(&logOutputFlags, "logs-output", "Specify locations for output logs, options are \"console\" and \"file\" (default \"console\")")
202202
flag.StringVar(&responseBodyFilesPath, "response-body-files-path", "", "When a response contains a relative bodyFile, it will be resolved against this path (default is CWD)")
203-
flag.Var(&responseBodyFilesAllowedOriginFlags, "response-body-files-allowed-origin", "When a response contains a url in bodyFile, it will be loaded only if the origin is allowed")
203+
flag.Var(&responseBodyFilesAllowedOriginFlags, "response-body-files-allow-origin", "When a response contains a url in bodyFile, it will be loaded only if the origin is allowed")
204204

205205
flag.Parse()
206206

core/hoverfly_funcs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ func (hf *Hoverfly) readResponseBodyURL(fileURL string) (string, error) {
161161
}
162162

163163
if !isAllowed {
164-
return "", fmt.Errorf("bodyFile %s is not allowed. To allow this origin run hoverfly with -response-body-files-allowed-origin", fileURL)
164+
return "", fmt.Errorf("bodyFile %s is not allowed. To allow this origin run hoverfly with -response-body-files-allow-origin", fileURL)
165165
}
166166

167167
resp, err := http.DefaultClient.Get(fileURL)

docs/pages/keyconcepts/simulations/pairs.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,4 +173,10 @@ response bodies from external urls:
173173
"bodyFile": "https://raw.githubusercontent.com/SpectoLabs/hoverfly/master/schema.json"
174174
}
175175
176-
Like local files, this feature is supported only on simulation import.
176+
Like local files, this feature is supported only on simulation import. To escape security issues there's another
177+
mandatory option to specify :code:`-response-body-files-allow-origin` that lets you explicitly set the collections of
178+
urls to allow body files to be downloaded from. For the above to work you need to run hoverfly like this:
179+
180+
.. code:: bash
181+
182+
hoverfly -response-body-files-allow-origin="https://raw.githubusercontent.com/"

docs/pages/reference/hoverfly/hoverfly.output

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ Usage of hoverfly:
8383
Proxy port - run proxy on another port (i.e. '-pp 9999' to run proxy on port 9999)
8484
-proxy-auth Proxy-Authorization
8585
Switch the Proxy-Authorization header from proxy-auth Proxy-Authorization to header-auth `X-HOVERFLY-AUTHORIZATION`. Switching to header-auth will auto enable -https-only (default "proxy-auth")
86+
-response-body-files-allow-origin value
87+
When a response contains a url in bodyFile, it will be loaded only if the origin is allowed
8688
-response-body-files-path string
8789
When a response contains a relative bodyFile, it will be resolved against this path (default is CWD)
8890
-spy

0 commit comments

Comments
 (0)