Skip to content

Commit ed98733

Browse files
authored
Response headers
Response headers
2 parents 5e41b78 + 0e99ee1 commit ed98733

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

spec/amadeus/client/response.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ describe('Response', () => {
2020
});
2121

2222
it('should initialize the params', () => {
23-
expect(response.contentType).toBe('application/json');
2423
expect(response.statusCode).toBe(200);
24+
expect(response.headers).toEqual(http_response.headers);
2525
expect(response.request).toEqual(request);
2626
expect(response.body).toEqual('');
2727
expect(response.result).toEqual(null);

src/amadeus/client/response.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ let JSON_CONTENT_TYPES = ['application/json', 'application/vnd.amadeus+json'];
1717
*/
1818
class Response {
1919
constructor(http_response, request) {
20-
let headers = http_response.headers || {};
21-
this.contentType = headers['content-type'];
20+
this.headers = http_response.headers || {};
2221
this.statusCode = http_response.statusCode;
2322
this.request = request;
2423
this.body = '';
@@ -79,7 +78,7 @@ class Response {
7978
* @private
8079
*/
8180
isJson() {
82-
return (JSON_CONTENT_TYPES.indexOf(this.contentType) !== -1);
81+
return (JSON_CONTENT_TYPES.indexOf(this.headers['content-type']) !== -1);
8382
}
8483
}
8584

0 commit comments

Comments
 (0)