From 2c68c2a72755ad66e1ecdc566add9f91e65af717 Mon Sep 17 00:00:00 2001 From: Christian Date: Mon, 13 Jul 2020 17:25:05 -0400 Subject: [PATCH 1/2] added http content type to options --- bridge.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bridge.go b/bridge.go index 8de867a..535835c 100755 --- a/bridge.go +++ b/bridge.go @@ -298,6 +298,7 @@ type CallOpts struct { QueryPassthrough bool `json:"queryPassthrough"` Body string `json:"body"` ExpectedCode int `json:"expectedCode"` + ContentType string `json:"ContentType"` } // HTTPCall performs a basic http call with no options @@ -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 == "") { + req.Header.Add("Content-Type", "application/json") + } else { + req.Header.Add("Content-Type", opts.ContentType) + } q := req.URL.Query() if opts.QueryPassthrough { From ddb21f797fb20b4874366f4e7fe41d12e3a7d6c3 Mon Sep 17 00:00:00 2001 From: Christian Date: Thu, 16 Jul 2020 14:18:45 -0400 Subject: [PATCH 2/2] formatting --- bridge.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bridge.go b/bridge.go index 535835c..80a9973 100755 --- a/bridge.go +++ b/bridge.go @@ -298,7 +298,7 @@ type CallOpts struct { QueryPassthrough bool `json:"queryPassthrough"` Body string `json:"body"` ExpectedCode int `json:"expectedCode"` - ContentType string `json:"ContentType"` + ContentType string `json:"ContentType"` } // HTTPCall performs a basic http call with no options @@ -343,7 +343,7 @@ func (h *Helper) HTTPCallRawWithOptsWithContext(ctx context.Context, method, url return nil, err } - if (opts.ContentType == "") { + if len(opts.ContentType) == 0 { req.Header.Add("Content-Type", "application/json") } else { req.Header.Add("Content-Type", opts.ContentType)