Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support binary/octet-stream response body #75

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## 11.2.1
### Changed
- Add support for binary/octet-stream.

## 11.2.0
### Changed
- Requires at least PHP 7.2, updates used internal libraries.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class BodyResolver
const BODY_JSON = 'application/json';
const BODY_JAVASCRIPT = 'application/javascript';
const BODY_OCTET_STREAM = 'application/octet-stream';
const BODY_BINARY_OCTET_STREAM = 'binary/octet-stream';

/**
* @param Method $method
Expand Down Expand Up @@ -60,6 +61,10 @@ public function getResponseBody(Method $method)
return $okResponse->getBodyByType(self::BODY_OCTET_STREAM);
} catch (Exception $exception) {}

try {
return $okResponse->getBodyByType(self::BODY_BINARY_OCTET_STREAM);
} catch (Exception $exception) {}

throw new Exception('No body found');
}

Expand Down