File tree Expand file tree Collapse file tree 3 files changed +15
-2
lines changed Expand file tree Collapse file tree 3 files changed +15
-2
lines changed Original file line number Diff line number Diff line change 1
- .idea
1
+ .idea
2
+ .vscode /settings.json
Original file line number Diff line number Diff line change @@ -55,7 +55,8 @@ class Response {
55
55
body: body != null ? jsonEncode (body) : null ,
56
56
headers: {
57
57
...headers,
58
- HttpHeaders .contentTypeHeader: ContentType .json.value,
58
+ if (! headers.containsKey (HttpHeaders .contentTypeHeader))
59
+ HttpHeaders .contentTypeHeader: ContentType .json.value,
59
60
},
60
61
);
61
62
Original file line number Diff line number Diff line change @@ -184,6 +184,17 @@ void main() {
184
184
final response = Response .json ();
185
185
expect (response.json (), completion (isEmpty));
186
186
});
187
+
188
+ test ('has correct content-type when overriden in headers' , () {
189
+ final headers = < String , String > {
190
+ HttpHeaders .contentTypeHeader: ContentType .html.value,
191
+ };
192
+ final response = Response .json (headers: headers);
193
+ expect (
194
+ response.headers[HttpHeaders .contentTypeHeader],
195
+ equals (ContentType .html.value),
196
+ );
197
+ });
187
198
});
188
199
});
189
200
}
You can’t perform that action at this time.
0 commit comments