Skip to content

Commit

Permalink
chore: restrict surface
Browse files Browse the repository at this point in the history
  • Loading branch information
XVincentX committed May 11, 2020
1 parent 9e1c085 commit d4d4ab9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions packages/http/src/mocker/negotiator/NegotiatorHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,15 @@ const helpers = {
},

negotiateOptionsBySpecificResponse(
httpOperation: Pick<IHttpOperation, 'method'>,
requestMethod: string,
desiredOptions: NegotiationOptions,
response: IHttpOperationResponse
): RE.ReaderEither<Logger, Error, IHttpNegotiationResult> {
const { code, headers } = response;
const { mediaTypes, dynamic, exampleKey } = desiredOptions;

return logger => {
if (httpOperation.method === 'head') {
if (requestMethod === 'head') {
logger.info(`Responding with an empty body to a HEAD request.`);

return E.right({
Expand Down Expand Up @@ -218,7 +218,7 @@ const helpers = {
findLowest2xx(httpOperation.responses),
RE.fromOption(() => ProblemJsonError.fromTemplate(NO_SUCCESS_RESPONSE_DEFINED)),
RE.chain(lowest2xxResponse =>
helpers.negotiateOptionsBySpecificResponse(httpOperation, desiredOptions, lowest2xxResponse)
helpers.negotiateOptionsBySpecificResponse(httpOperation.method, desiredOptions, lowest2xxResponse)
)
);
},
Expand Down Expand Up @@ -247,7 +247,7 @@ const helpers = {
),
RE.chain(response =>
pipe(
helpers.negotiateOptionsBySpecificResponse(httpOperation, desiredOptions, response),
helpers.negotiateOptionsBySpecificResponse(httpOperation.method, desiredOptions, response),
RE.orElse(() =>
pipe(
helpers.negotiateOptionsForDefaultCode(httpOperation, desiredOptions),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ describe('NegotiatorHelpers', () => {
jest.spyOn(helpers, 'negotiateDefaultMediaType');

const actualOperationConfig = helpers.negotiateOptionsBySpecificResponse(
httpOperation,
httpOperation.method,
desiredOptions,
httpResponseSchema
)(logger);
Expand Down Expand Up @@ -511,7 +511,7 @@ describe('NegotiatorHelpers', () => {
};

const actualOperationConfig = helpers.negotiateOptionsBySpecificResponse(
httpOperation,
httpOperation.method,
desiredOptions,
httpResponseSchema
)(logger);
Expand All @@ -538,7 +538,7 @@ describe('NegotiatorHelpers', () => {
};

const actualOperationConfig = helpers.negotiateOptionsBySpecificResponse(
httpOperation,
httpOperation.method,
desiredOptions,
httpResponseSchema
)(logger);
Expand All @@ -560,7 +560,7 @@ describe('NegotiatorHelpers', () => {
};

const actualResponse = helpers.negotiateOptionsBySpecificResponse(
httpOperation,
httpOperation.method,
desiredOptions,
httpResponseSchema
)(logger);
Expand All @@ -576,7 +576,7 @@ describe('NegotiatorHelpers', () => {
};

const actualResponse = helpers.negotiateOptionsBySpecificResponse(
httpOperation,
httpOperation.method,
desiredOptions,
httpResponseSchema
)(logger);
Expand All @@ -602,7 +602,7 @@ describe('NegotiatorHelpers', () => {
};

const actualResponse = helpers.negotiateOptionsBySpecificResponse(
httpOperation,
httpOperation.method,
desiredOptions,
httpResponseSchema
)(logger);
Expand Down Expand Up @@ -636,7 +636,7 @@ describe('NegotiatorHelpers', () => {
jest.spyOn(helpers, 'negotiateDefaultMediaType').mockReturnValue(E.right(fakeOperationConfig));

const actualOperationConfig = helpers.negotiateOptionsBySpecificResponse(
httpOperation,
httpOperation.method,
desiredOptions,
httpResponseSchema
)(logger);
Expand Down

0 comments on commit d4d4ab9

Please sign in to comment.