Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ type CallOpts struct {
QueryPassthrough bool `json:"queryPassthrough"`
Body string `json:"body"`
ExpectedCode int `json:"expectedCode"`
ContentType string `json:"ContentType"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs formatting

}

// HTTPCall performs a basic http call with no options
Expand Down Expand Up @@ -341,7 +342,12 @@ func (h *Helper) HTTPCallRawWithOptsWithContext(ctx context.Context, method, url
if err != nil {
return nil, err
}
req.Header.Add("Content-Type", "application/json")

if (opts.ContentType == "") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trivial change, but personally prefer len(opts.ContentType) > 0 in Go, as it looks a bit cleaner rather than literal string matching.

req.Header.Add("Content-Type", "application/json")
} else {
req.Header.Add("Content-Type", opts.ContentType)
}

q := req.URL.Query()
if opts.QueryPassthrough {
Expand Down