generated from apollographql/typescript-repo-template
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Preserve
body
on request object passed to willSendRequest
; fix `s…
…tring` and `Buffer` body handling (#89) The v4 update introduced multiple regressions w.r.t. the `modifiedRequest` object that was added. * `body` was no longer being added to the intermediary request object before calling `willSendRequest` * `modifiedRequest.body` was never being set in the case that the incoming body was a `string` or `Buffer` This change resolves both by reverting to what we previously had in v3 (preserving the properties on the incoming request object). The types had to be updated accordingly. Due to how `path` is now handled in v4, the `willSendRequest` signature has been updated to `(path, request)`.
- Loading branch information
1 parent
23d7e47
commit 4a249ec
Showing
6 changed files
with
214 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
'@apollo/datasource-rest': major | ||
--- | ||
|
||
This change restores the full functionality of `willSendRequest` which | ||
previously existed in the v3 version of this package. The v4 change introduced a | ||
regression where the incoming request's `body` was no longer included in the | ||
object passed to the `willSendRequest` hook, it was always `undefined`. | ||
|
||
For consistency and typings reasons, the `path` argument is now the first | ||
argument to the `willSendRequest` hook, followed by the `AugmentedRequest` | ||
request object. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
'@apollo/datasource-rest': patch | ||
--- | ||
|
||
`string` and `Buffer` bodies are now correctly included on the outgoing request. | ||
Due to a regression in v4, they were ignored and never sent as the `body`. | ||
`string` and `Buffer` bodies are now passed through to the outgoing request | ||
(without being JSON stringified). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.