Skip to content
This repository was archived by the owner on Apr 3, 2025. It is now read-only.

Commit aca5d0e

Browse files
committed
fix(http): correctly set content type for POST requests
1 parent 26a35aa commit aca5d0e

File tree

11 files changed

+18
-3
lines changed

11 files changed

+18
-3
lines changed

lib/api/lidarr/api.dart

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ abstract class LidarrAPI {
2121
queryParameters: {
2222
if (apiKey.isNotEmpty) 'apikey': apiKey,
2323
},
24+
contentType: Headers.jsonContentType,
25+
responseType: ResponseType.json,
2426
));
2527
return _LidarrAPI(dio, baseUrl: _baseUrl(host));
2628
}

lib/api/nzbget/api.dart

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
import 'dart:convert';
2-
import 'package:dio/dio.dart';
31
import 'package:lunasea/api/nzbget/models/status.dart';
42
import 'package:lunasea/api/nzbget/models/version.dart';
5-
import 'package:retrofit/retrofit.dart';
3+
import 'package:lunasea/vendor.dart';
64

75
part 'api.g.dart';
86

@@ -51,6 +49,8 @@ abstract class NZBGetAPI {
5149
headers: headers,
5250
followRedirects: true,
5351
maxRedirects: 5,
52+
contentType: Headers.jsonContentType,
53+
responseType: ResponseType.json,
5454
));
5555
_attachInterceptor(dio);
5656
_setResponseTransformer(dio);

lib/api/overseerr/api.dart

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ abstract class OverseerrAPI {
2727
'X-Api-Key': apiKey,
2828
...headers,
2929
},
30+
contentType: Headers.jsonContentType,
31+
responseType: ResponseType.json,
3032
followRedirects: true,
3133
maxRedirects: 5,
3234
),

lib/api/radarr/radarr.dart

+1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ class RadarrAPI {
6868
headers: headers,
6969
followRedirects: followRedirects,
7070
maxRedirects: maxRedirects,
71+
contentType: Headers.jsonContentType,
7172
responseType: ResponseType.json,
7273
),
7374
);

lib/api/sabnzbd/api.dart

+2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ abstract class SABnzbdAPI {
3232
headers: headers,
3333
followRedirects: true,
3434
maxRedirects: 5,
35+
contentType: Headers.jsonContentType,
36+
responseType: ResponseType.json,
3537
queryParameters: {
3638
if (apiKey.isNotEmpty) 'apikey': apiKey,
3739
'output': 'json',

lib/api/sonarr/sonarr.dart

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ class SonarrAPI {
3636
queryParameters: {
3737
'apikey': apiKey,
3838
},
39+
contentType: Headers.jsonContentType,
3940
responseType: ResponseType.json,
4041
headers: headers,
4142
followRedirects: followRedirects,

lib/api/tautulli/tautulli.dart

+1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ class TautulliAPI {
5151
queryParameters: {
5252
'apikey': apiKey,
5353
},
54+
contentType: Headers.jsonContentType,
5455
responseType: ResponseType.json,
5556
headers: headers,
5657
followRedirects: followRedirects,

lib/modules/dashboard/core/api/api.dart

+3
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ class API {
4848
'start': _startDate(today),
4949
'end': _endDate(today),
5050
},
51+
contentType: Headers.jsonContentType,
5152
responseType: ResponseType.json,
5253
headers: profile.lidarrHeaders,
5354
followRedirects: true,
@@ -92,6 +93,7 @@ class API {
9293
'start': _startDate(today),
9394
'end': _endDate(today),
9495
},
96+
contentType: Headers.jsonContentType,
9597
responseType: ResponseType.json,
9698
headers: profile.radarrHeaders,
9799
followRedirects: true,
@@ -147,6 +149,7 @@ class API {
147149
'start': _startDate(today),
148150
'end': _endDate(today),
149151
},
152+
contentType: Headers.jsonContentType,
150153
responseType: ResponseType.json,
151154
headers: profile.sonarrHeaders,
152155
followRedirects: true,

lib/modules/lidarr/core/api/api.dart

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ class LidarrAPI {
1414
queryParameters: {
1515
if (profile.lidarrKey != '') 'apikey': profile.lidarrKey,
1616
},
17+
contentType: Headers.jsonContentType,
1718
responseType: ResponseType.json,
1819
headers: LunaProfile.current.lidarrHeaders,
1920
followRedirects: true,

lib/modules/nzbget/core/api/api.dart

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class NZBGetAPI {
1717
headers: profile.nzbgetHeaders,
1818
followRedirects: true,
1919
maxRedirects: 5,
20+
contentType: Headers.jsonContentType,
2021
responseType: ResponseType.json,
2122
),
2223
);

lib/modules/sabnzbd/core/api/api.dart

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class SABnzbdAPI {
1818
headers: profile.sabnzbdHeaders,
1919
followRedirects: true,
2020
maxRedirects: 5,
21+
contentType: Headers.jsonContentType,
2122
responseType: ResponseType.json,
2223
),
2324
);

0 commit comments

Comments
 (0)