Skip to content

Commit

Permalink
Merge pull request #393 from Workiva/fix-send-body-param-with-fall-th…
Browse files Browse the repository at this point in the history
…rough-requests

FEA-1797: Bug fix for the `send` method's `body` param on fall through requests
  • Loading branch information
rmconsole2-wf authored Apr 26, 2023
2 parents 27e0143 + 4dff6f7 commit f3144f6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## [4.1.6] (https://github.com/Workiva/w_transport/compare/4.1.5...4.1.6)

- **Bug Fix:** When using `MockTransports.install(fallThrough: true)`, the
optional `body` param on the `send()` method will now properly be applied when
the request "falls through" the mock config to a real request.
- **Docs:** Suggest using `.streamGet()` over `.get()` for binary responses that
will be read as bytes (via `body.asBytes()`).

Expand Down
4 changes: 2 additions & 2 deletions lib/src/http/common/request.dart
Original file line number Diff line number Diff line change
Expand Up @@ -748,8 +748,8 @@ abstract class CommonRequest extends Object
this.method, this.uri, this.headers)) {
final realRequest = switchToRealRequest();
return streamResponse
? realRequest.streamSend(method)
: realRequest.send(method);
? realRequest.streamSend(method, body: body)
: realRequest.send(method, body: body);
}

// Otherwise, carry on with the send logic and the mocks will do the rest.
Expand Down

0 comments on commit f3144f6

Please sign in to comment.