Skip to content

Commit

Permalink
fix(mocker): a bug where Content-Type was set but we didn't find it
Browse files Browse the repository at this point in the history
- use helper function to get as case-insensitive

SL-1251
  • Loading branch information
Chris Miaskowski committed Jan 25, 2019
1 parent 59ed9be commit b5a9dd8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/http/src/mocker/HttpMocker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { IMocker, IMockerOpts } from '@stoplight/prism-core';
import { IHttpOperation, INodeExample } from '@stoplight/types';

import { IHttpConfig, IHttpRequest, IHttpResponse } from '../types';
import { getHeaderByName } from '../validator/utils/http';
import { IExampleGenerator } from './generator/IExampleGenerator';
import helpers from './negotiator/NegotiatorHelpers';

Expand All @@ -24,7 +25,8 @@ export class HttpMocker
}

// setting default values
const inputMediaType = input.data.headers && input.data.headers['Content-type'];
const inputMediaType =
input.data.headers && getHeaderByName(input.data.headers, 'content-type');
config = config || { mock: {} };
const mockConfig: any = typeof config.mock === 'boolean' ? {} : Object.assign({}, config.mock);
if (!mockConfig.mediaType && inputMediaType) {
Expand Down

0 comments on commit b5a9dd8

Please sign in to comment.