Skip to content

Commit

Permalink
refactor: format and changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
XVincentX committed Jan 20, 2020
1 parent 19a3677 commit 3d5ff88
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

- Replaced Fastify HTTP server with its tinier counterpart: Micri [#927](https://github.com/stoplightio/prism/pull/927)

## Fixed

- Prism's proxy will now strip all the Hop By Hop headers [#921](https://github.com/stoplightio/prism/pull/921)

# 3.2.3 (2019-12-19)

## Fixed
Expand Down
19 changes: 6 additions & 13 deletions packages/http/src/forwarder/__tests__/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,23 +102,16 @@ describe('forward', () => {
describe('when upstream return hop-by-hop headers', () => {
it('forwarder strips them all', () => {
const headers = mapValues(keyBy(hopByHopHeaders), () => 'n/a');

((fetch as unknown) as jest.Mock).mockReturnValue({
headers: { get: (n: string) => headers[n], raw: () => mapValues(headers, (h: string) => h.split(' ')) },
text: jest.fn().mockResolvedValue(''),
});
return assertResolvesRight(
forward(
{
method: 'get',
url: { path: '/test' },
},
'http://example.com'
)(logger),
r => {
hopByHopHeaders.forEach(hopHeader => {
expect(r.headers?.[hopHeader]).toBeUndefined();
});
}

return assertResolvesRight(forward({ method: 'get', url: { path: '/test' } }, 'http://example.com')(logger), r =>
hopByHopHeaders.forEach(hopHeader => {
expect(r.headers?.[hopHeader]).toBeUndefined();
})
);
});
});
Expand Down
2 changes: 1 addition & 1 deletion packages/http/src/forwarder/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const forward: IPrismComponents<IHttpOperation, IHttpRequest, IHttpResponse, IHt

export default forward;

function serializeBody(body: unknown) {
function serializeBody(body: unknown): E.Either<Error, string | undefined> {
if (typeof body === 'string') {
return E.right(body);
}
Expand Down

0 comments on commit 3d5ff88

Please sign in to comment.