Skip to content

Commit 867a329

Browse files
AbbasMathiewaumb
andauthored
fix: overriding headers (#53)
Co-authored-by: Mathiew Abbas <[email protected]>
1 parent b37594b commit 867a329

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

lib/data/interceptor/meta_interceptor.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,12 @@ class MetaInterceptor extends InterceptorsWrapper {
1414
@override
1515
void onRequest(
1616
RequestOptions options, RequestInterceptorHandler handler) async {
17-
options.headers['Accept'] = 'application/json; charset=UTF-8';
18-
options.headers['content-type'] = 'application/json';
17+
if (options.headers['Accept'] == null) {
18+
options.headers['Accept'] = 'application/json; charset=UTF-8';
19+
}
20+
if (options.headers['content-type'] == null) {
21+
options.headers['content-type'] = 'application/json';
22+
}
1923
options.headers[nMetaHeaderKey] = '$platform;${flavor.name};'
2024
'${await appVersion};${await platformVersion};${await device}';
2125
handler.next(options);

pubspec.lock

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ packages:
161161
name: collection
162162
url: "https://pub.dartlang.org"
163163
source: hosted
164-
version: "1.15.0"
164+
version: "1.16.0"
165165
convert:
166166
dependency: transitive
167167
description:
@@ -252,7 +252,7 @@ packages:
252252
name: fake_async
253253
url: "https://pub.dartlang.org"
254254
source: hosted
255-
version: "1.2.0"
255+
version: "1.3.0"
256256
ffi:
257257
dependency: transitive
258258
description:
@@ -414,7 +414,7 @@ packages:
414414
name: js
415415
url: "https://pub.dartlang.org"
416416
source: hosted
417-
version: "0.6.3"
417+
version: "0.6.4"
418418
json_annotation:
419419
dependency: "direct main"
420420
description:
@@ -456,7 +456,7 @@ packages:
456456
name: material_color_utilities
457457
url: "https://pub.dartlang.org"
458458
source: hosted
459-
version: "0.1.3"
459+
version: "0.1.4"
460460
meta:
461461
dependency: transitive
462462
description:
@@ -549,7 +549,7 @@ packages:
549549
name: path
550550
url: "https://pub.dartlang.org"
551551
source: hosted
552-
version: "1.8.0"
552+
version: "1.8.1"
553553
path_drawing:
554554
dependency: transitive
555555
description:
@@ -743,7 +743,7 @@ packages:
743743
name: source_span
744744
url: "https://pub.dartlang.org"
745745
source: hosted
746-
version: "1.8.1"
746+
version: "1.8.2"
747747
stack_trace:
748748
dependency: transitive
749749
description:
@@ -785,7 +785,7 @@ packages:
785785
name: test_api
786786
url: "https://pub.dartlang.org"
787787
source: hosted
788-
version: "0.4.8"
788+
version: "0.4.9"
789789
timing:
790790
dependency: transitive
791791
description:
@@ -827,7 +827,7 @@ packages:
827827
name: vector_math
828828
url: "https://pub.dartlang.org"
829829
source: hosted
830-
version: "2.1.1"
830+
version: "2.1.2"
831831
watcher:
832832
dependency: transitive
833833
description:
@@ -871,5 +871,5 @@ packages:
871871
source: hosted
872872
version: "3.1.0"
873873
sdks:
874-
dart: ">=2.16.0 <3.0.0"
874+
dart: ">=2.17.0-0 <3.0.0"
875875
flutter: ">=2.8.0"

0 commit comments

Comments
 (0)