Skip to content

Commit

Permalink
fix(http): correctly set content type for POST requests
Browse files Browse the repository at this point in the history
  • Loading branch information
JagandeepBrar committed Feb 17, 2023
1 parent 26a35aa commit aca5d0e
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 3 deletions.
2 changes: 2 additions & 0 deletions lib/api/lidarr/api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ abstract class LidarrAPI {
queryParameters: {
if (apiKey.isNotEmpty) 'apikey': apiKey,
},
contentType: Headers.jsonContentType,
responseType: ResponseType.json,
));
return _LidarrAPI(dio, baseUrl: _baseUrl(host));
}
Expand Down
6 changes: 3 additions & 3 deletions lib/api/nzbget/api.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import 'dart:convert';
import 'package:dio/dio.dart';
import 'package:lunasea/api/nzbget/models/status.dart';
import 'package:lunasea/api/nzbget/models/version.dart';
import 'package:retrofit/retrofit.dart';
import 'package:lunasea/vendor.dart';

part 'api.g.dart';

Expand Down Expand Up @@ -51,6 +49,8 @@ abstract class NZBGetAPI {
headers: headers,
followRedirects: true,
maxRedirects: 5,
contentType: Headers.jsonContentType,
responseType: ResponseType.json,
));
_attachInterceptor(dio);
_setResponseTransformer(dio);
Expand Down
2 changes: 2 additions & 0 deletions lib/api/overseerr/api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ abstract class OverseerrAPI {
'X-Api-Key': apiKey,
...headers,
},
contentType: Headers.jsonContentType,
responseType: ResponseType.json,
followRedirects: true,
maxRedirects: 5,
),
Expand Down
1 change: 1 addition & 0 deletions lib/api/radarr/radarr.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class RadarrAPI {
headers: headers,
followRedirects: followRedirects,
maxRedirects: maxRedirects,
contentType: Headers.jsonContentType,
responseType: ResponseType.json,
),
);
Expand Down
2 changes: 2 additions & 0 deletions lib/api/sabnzbd/api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ abstract class SABnzbdAPI {
headers: headers,
followRedirects: true,
maxRedirects: 5,
contentType: Headers.jsonContentType,
responseType: ResponseType.json,
queryParameters: {
if (apiKey.isNotEmpty) 'apikey': apiKey,
'output': 'json',
Expand Down
1 change: 1 addition & 0 deletions lib/api/sonarr/sonarr.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class SonarrAPI {
queryParameters: {
'apikey': apiKey,
},
contentType: Headers.jsonContentType,
responseType: ResponseType.json,
headers: headers,
followRedirects: followRedirects,
Expand Down
1 change: 1 addition & 0 deletions lib/api/tautulli/tautulli.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class TautulliAPI {
queryParameters: {
'apikey': apiKey,
},
contentType: Headers.jsonContentType,
responseType: ResponseType.json,
headers: headers,
followRedirects: followRedirects,
Expand Down
3 changes: 3 additions & 0 deletions lib/modules/dashboard/core/api/api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class API {
'start': _startDate(today),
'end': _endDate(today),
},
contentType: Headers.jsonContentType,
responseType: ResponseType.json,
headers: profile.lidarrHeaders,
followRedirects: true,
Expand Down Expand Up @@ -92,6 +93,7 @@ class API {
'start': _startDate(today),
'end': _endDate(today),
},
contentType: Headers.jsonContentType,
responseType: ResponseType.json,
headers: profile.radarrHeaders,
followRedirects: true,
Expand Down Expand Up @@ -147,6 +149,7 @@ class API {
'start': _startDate(today),
'end': _endDate(today),
},
contentType: Headers.jsonContentType,
responseType: ResponseType.json,
headers: profile.sonarrHeaders,
followRedirects: true,
Expand Down
1 change: 1 addition & 0 deletions lib/modules/lidarr/core/api/api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class LidarrAPI {
queryParameters: {
if (profile.lidarrKey != '') 'apikey': profile.lidarrKey,
},
contentType: Headers.jsonContentType,
responseType: ResponseType.json,
headers: LunaProfile.current.lidarrHeaders,
followRedirects: true,
Expand Down
1 change: 1 addition & 0 deletions lib/modules/nzbget/core/api/api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class NZBGetAPI {
headers: profile.nzbgetHeaders,
followRedirects: true,
maxRedirects: 5,
contentType: Headers.jsonContentType,
responseType: ResponseType.json,
),
);
Expand Down
1 change: 1 addition & 0 deletions lib/modules/sabnzbd/core/api/api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class SABnzbdAPI {
headers: profile.sabnzbdHeaders,
followRedirects: true,
maxRedirects: 5,
contentType: Headers.jsonContentType,
responseType: ResponseType.json,
),
);
Expand Down

0 comments on commit aca5d0e

Please sign in to comment.