MCPcopy
hub / github.com/davecheney/httpstat / createBody

Function createBody

main.go:411–421  ·  view source on GitHub ↗
(body string)

Source from the content-addressed store, hash-verified

409}
410
411func createBody(body string) io.Reader {
412 if strings.HasPrefix(body, "@") {
413 filename := body[1:]
414 f, err := os.Open(filename)
415 if err != nil {
416 log.Fatalf("failed to open data file %s: %v", filename, err)
417 }
418 return f
419 }
420 return strings.NewReader(body)
421}
422
423// getFilenameFromHeaders tries to automatically determine the output filename,
424// when saving to disk, based on the Content-Disposition header.

Callers 1

newRequestFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected