initial codex commit
This commit is contained in:
@@ -35,10 +35,11 @@ class ApiService {
|
||||
dynamic data, {
|
||||
Map<String, String>? headers,
|
||||
}) async {
|
||||
final hasBody = data != null;
|
||||
final response = await http.post(
|
||||
Uri.parse('$baseUrl$endpoint'),
|
||||
headers: _buildHeaders(_jsonHeaders(headers)),
|
||||
body: jsonEncode(data),
|
||||
headers: _buildHeaders(hasBody ? _jsonHeaders(headers) : headers),
|
||||
body: hasBody ? jsonEncode(data) : null,
|
||||
);
|
||||
return _processResponse(response);
|
||||
}
|
||||
@@ -60,10 +61,11 @@ class ApiService {
|
||||
dynamic data, {
|
||||
Map<String, String>? headers,
|
||||
}) async {
|
||||
final hasBody = data != null;
|
||||
final response = await http.put(
|
||||
Uri.parse('$baseUrl$endpoint'),
|
||||
headers: _buildHeaders(_jsonHeaders(headers)),
|
||||
body: jsonEncode(data),
|
||||
headers: _buildHeaders(hasBody ? _jsonHeaders(headers) : headers),
|
||||
body: hasBody ? jsonEncode(data) : null,
|
||||
);
|
||||
return _processResponse(response);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user