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 {
5555 body: body != null ? jsonEncode (body) : null ,
5656 headers: {
5757 ...headers,
58- HttpHeaders .contentTypeHeader: ContentType .json.value,
58+ if (! headers.containsKey (HttpHeaders .contentTypeHeader))
59+ HttpHeaders .contentTypeHeader: ContentType .json.value,
5960 },
6061 );
6162
Original file line number Diff line number Diff line change @@ -184,6 +184,17 @@ void main() {
184184 final response = Response .json ();
185185 expect (response.json (), completion (isEmpty));
186186 });
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+ });
187198 });
188199 });
189200}
You can’t perform that action at this time.
0 commit comments