Skip to content

Commit 29c53eb

Browse files
Pass Context Through Postman NewRequest (#4190)
This allows the underlying http request to respect the context
1 parent 5581f08 commit 29c53eb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pkg/sources/postman/postman_client.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,8 @@ func NewClient(postmanToken string, metrics *metrics) *Client {
232232

233233
// NewRequest creates an API request (Only GET needed for our interaction w/ Postman)
234234
// If specified, the map provided by headers will be used to update request headers.
235-
func (c *Client) NewRequest(urlStr string, headers map[string]string) (*http.Request, error) {
236-
req, err := http.NewRequest("GET", urlStr, nil)
235+
func (c *Client) NewRequest(ctx trContext.Context, urlStr string, headers map[string]string) (*http.Request, error) {
236+
req, err := http.NewRequestWithContext(ctx, "GET", urlStr, nil)
237237
if err != nil {
238238
return nil, err
239239
}
@@ -263,7 +263,7 @@ func checkResponseStatus(r *http.Response) error {
263263
func (c *Client) getPostmanResponseBodyBytes(ctx trContext.Context, urlString string, headers map[string]string) ([]byte, error) {
264264
ctx = trContext.WithValues(ctx, "url", urlString)
265265

266-
req, err := c.NewRequest(urlString, headers)
266+
req, err := c.NewRequest(ctx, urlString, headers)
267267
if err != nil {
268268
return nil, err
269269
}

0 commit comments

Comments
 (0)