@@ -14,15 +14,9 @@ import { Option } from 'fp-ts/lib/Option';
14
14
import { ReferenceObject , ReferenceObjectCodec } from '../../../../schema/3.0/reference-object' ;
15
15
import { getKeyMatchValue , getKeyMatchValues , getResponseTypeFromMediaType , XHRResponseType } from '../../common/utils' ;
16
16
import { SchemaObject } from '../../../../schema/3.0/schema-object' ;
17
- import { MediaTypeObject } from '../../../../schema/3.0/media-type-object' ;
18
17
import { sequenceEither } from '@devexperts/utils/dist/adt/either.utils' ;
19
18
20
19
const requestMediaRegexp = / ^ ( v i d e o | a u d i o | i m a g e | a p p l i c a t i o n | t e x t ) / ;
21
- export const getResponseMedia = ( content : Record < string , MediaTypeObject > ) =>
22
- getKeyMatchValue ( content , requestMediaRegexp ) ;
23
-
24
- export const getResponseMedia2 = ( content : Record < string , MediaTypeObject > ) =>
25
- getKeyMatchValues ( content , requestMediaRegexp ) ;
26
20
27
21
export type SerializedResponse = { mediaType : string ; schema : SerializedType } ;
28
22
@@ -32,7 +26,7 @@ export const serializeResponseObject = (
32
26
) : Option < Either < Error , SerializedType > > =>
33
27
pipe (
34
28
responseObject . content ,
35
- option . chain ( content => getResponseMedia ( content ) ) ,
29
+ option . chain ( content => getKeyMatchValue ( content , requestMediaRegexp ) ) ,
36
30
option . chain ( ( { key : mediaType , value : { schema } } ) =>
37
31
pipe (
38
32
schema ,
@@ -51,7 +45,7 @@ export const serializeResponseObjectWithMediaType = (
51
45
) : Option < Either < Error , SerializedResponse [ ] > > =>
52
46
pipe (
53
47
responseObject . content ,
54
- option . chain ( content => getResponseMedia2 ( content ) ) ,
48
+ option . chain ( content => getKeyMatchValues ( content , requestMediaRegexp ) ) ,
55
49
option . chain ( arr =>
56
50
pipe (
57
51
arr ,
0 commit comments