Skip to content

Commit a22024a

Browse files
fix: more verbose error
1 parent a5c7555 commit a22024a

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

packages/http/src/validator/__tests__/__snapshots__/functional.spec.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Object {
3939
"_tag": "Left",
4040
"left": Array [
4141
Object {
42-
"message": "The received media type does not match the one specified in the document",
42+
"message": "The received media type \\"\\" does not match the one specified in the document",
4343
"severity": 0,
4444
},
4545
Object {

packages/http/src/validator/__tests__/index.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ describe('HttpValidator', () => {
242242
error =>
243243
expect(error).toEqual([
244244
{
245-
message: 'The received media type does not match the one specified in the document',
245+
message: 'The received media type "application/xml" does not match the one specified in the document',
246246
severity: DiagnosticSeverity.Error,
247247
},
248248
])

packages/http/src/validator/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ const mismatchMediaType = (response: IHttpOperationResponse, mediaType: string)
8989
Option.fromNullable(response.contents),
9090
Option.chain(findFirst(c => c.mediaType === mediaType)),
9191
Either.fromOption<IPrismDiagnostic>(() => ({
92-
message: `The received media type does not match the one specified in the document`,
92+
message: `The received media type "${
93+
mediaType ? mediaType : ''
94+
}" does not match the one specified in the document`,
9395
severity: DiagnosticSeverity.Error,
9496
})),
9597
Either.mapLeft<IPrismDiagnostic, NonEmptyArray<IPrismDiagnostic>>(e => [e])

0 commit comments

Comments
 (0)