Skip to content

Commit

Permalink
example: demonstrate both ways to use multi-valued headers
Browse files Browse the repository at this point in the history
  • Loading branch information
mefellows committed Aug 2, 2023
1 parent ac9b1e0 commit b556ba5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
13 changes: 7 additions & 6 deletions examples/mocha/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@ exports.getMeDogs = (endpoint) => {
headers: {
'X-Custom-Header':
'{"id":"asd-asdasd-sd","additionalInfo":"some additional string"}',
Accept: [
'application/problem+json',
'application/json',
'text/plain',
'*/*',
],
Accept: ['application/problem+json, application/json, text/plain, */*'],
// Accept: [ // <- either mode is supported
// 'application/problem+json',
// 'application/json',
// 'text/plain',
// '*/*',
// ],
},
});
};
Expand Down
15 changes: 8 additions & 7 deletions examples/mocha/test/get-dogs.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,14 @@ describe('The Dog API', () => {
headers: {
'X-Custom-Header':
'{"id":"asd-asdasd-sd","additionalInfo":"some additional string"}',
// Accept: 'application/problem+json, application/json, text/plain, */*', // <- fails, must use array syntax ❌
Accept: [
'application/problem+json',
'application/json',
'text/plain',
'*/*',
],
Accept:
'application/problem+json, application/json, text/plain, */*',
// Accept: [ // <- either mode is supported
// 'application/problem+json',
// 'application/json',
// 'text/plain',
// '*/*',
// ],
},
},
willRespondWith: {
Expand Down

0 comments on commit b556ba5

Please sign in to comment.