fix(http): correctly set content type for POST requests

This commit is contained in:
Jagandeep Brar
2023-02-17 00:07:44 -05:00
parent 26a35aadb1
commit aca5d0eb82
11 changed files with 18 additions and 3 deletions

View File

@@ -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));
}

View File

@@ -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';
@@ -51,6 +49,8 @@ abstract class NZBGetAPI {
headers: headers,
followRedirects: true,
maxRedirects: 5,
contentType: Headers.jsonContentType,
responseType: ResponseType.json,
));
_attachInterceptor(dio);
_setResponseTransformer(dio);

View File

@@ -27,6 +27,8 @@ abstract class OverseerrAPI {
'X-Api-Key': apiKey,
...headers,
},
contentType: Headers.jsonContentType,
responseType: ResponseType.json,
followRedirects: true,
maxRedirects: 5,
),

View File

@@ -68,6 +68,7 @@ class RadarrAPI {
headers: headers,
followRedirects: followRedirects,
maxRedirects: maxRedirects,
contentType: Headers.jsonContentType,
responseType: ResponseType.json,
),
);

View File

@@ -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',

View File

@@ -36,6 +36,7 @@ class SonarrAPI {
queryParameters: {
'apikey': apiKey,
},
contentType: Headers.jsonContentType,
responseType: ResponseType.json,
headers: headers,
followRedirects: followRedirects,

View File

@@ -51,6 +51,7 @@ class TautulliAPI {
queryParameters: {
'apikey': apiKey,
},
contentType: Headers.jsonContentType,
responseType: ResponseType.json,
headers: headers,
followRedirects: followRedirects,