@@ -71,8 +71,8 @@ describe(packageJson.name, () => {
71
71
} )
72
72
. expect ( 200 ) ) ;
73
73
74
- it ( 'should succeed in sending a content-type: "application/json; version=1"' , async ( ) =>
75
- request ( app )
74
+ it ( 'should succeed in sending a content-type: "application/json; version=1" in multiple ways ' , async ( ) => {
75
+ await request ( app )
76
76
. post ( `${ app . basePath } /pets_content_types` )
77
77
. set ( 'Content-Type' , 'application/json; version=1' )
78
78
. set ( 'Accept' , 'application/json' )
@@ -83,9 +83,22 @@ describe(packageJson.name, () => {
83
83
. expect ( 200 )
84
84
. expect ( ( res ) => {
85
85
expect ( res . body . contentType ) . to . equal ( 'application/json; version=1' )
86
- } )
87
- ) ;
86
+ } ) ;
88
87
88
+ await request ( app )
89
+ . post ( `${ app . basePath } /pets_content_types` )
90
+ . set ( 'Content-Type' , 'application/json;version=1' )
91
+ . set ( 'Accept' , 'application/json' )
92
+ . send ( {
93
+ name : 'myPet' ,
94
+ tag : 'cat' ,
95
+ } )
96
+ . expect ( 200 )
97
+ . expect ( ( res ) => {
98
+ expect ( res . body . contentType ) . to . equal ( 'application/json;version=1' )
99
+ } ) ;
100
+ } ) ;
101
+
89
102
it ( 'should throw a 415 error for unsupported "application/json; version=2" content type' , async ( ) =>
90
103
request ( app )
91
104
. post ( `${ app . basePath } /pets_content_types` )
@@ -97,8 +110,8 @@ describe(packageJson.name, () => {
97
110
} )
98
111
. expect ( 415 ) ) ;
99
112
100
- it ( 'should succeed in sending a content-type: "application/json;version=1 ' , async ( ) =>
101
- request ( app )
113
+ it ( 'should throw a 415 error for a path/method which has previously succeeded using different request body content types ' , async ( ) => {
114
+ await request ( app )
102
115
. post ( `${ app . basePath } /pets_content_types` )
103
116
. set ( 'Content-Type' , 'application/json;version=1' )
104
117
. set ( 'Accept' , 'application/json' )
@@ -109,19 +122,17 @@ describe(packageJson.name, () => {
109
122
. expect ( 200 )
110
123
. expect ( ( res ) => {
111
124
expect ( res . body . contentType ) . to . equal ( 'application/json;version=1' )
112
- } )
113
- ) ;
114
-
115
- it ( 'should throw a 415 error for a path/method that\'s already been cached' , async ( ) =>
116
- request ( app )
125
+ } ) ;
126
+
127
+ await request ( app )
117
128
. post ( `${ app . basePath } /pets_content_types` )
118
129
. set ( 'Content-Type' , 'application/json; version=3' )
119
130
. set ( 'Accept' , 'application/json' )
120
131
. send ( {
121
132
name : 'myPet' ,
122
133
tag : 'cat' ,
123
134
} )
124
- . expect ( 415 ) ) ;
125
-
135
+ . expect ( 415 ) ;
136
+ } ) ;
126
137
} ) ;
127
138
} ) ;
0 commit comments