Skip to content
Snippets Groups Projects
Commit 1f924f75 authored by Martin Vogel's avatar Martin Vogel
Browse files

refactor: adjust headers (planning#2598)

parent 4fba2f50
No related branches found
No related tags found
1 merge request!501planning#2598 Dynamic Limits
......@@ -18,7 +18,6 @@ import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import static dev.fitko.fitconnect.core.http.MimeTypes.APPLICATION_JOSE;
import static dev.fitko.fitconnect.core.http.MimeTypes.APPLICATION_JSON;
public class DestinationApiService implements DestinationService {
......@@ -73,7 +72,7 @@ public class DestinationApiService implements DestinationService {
public void deleteDestination(final UUID destinationId) {
final String urlWithQueryParams = String.format(baseUrl + DESTINATION_PATH, destinationId);
try {
httpClient.delete(urlWithQueryParams, buildHeaders(APPLICATION_JOSE));
httpClient.delete(urlWithQueryParams, buildHeaders(APPLICATION_JSON));
} catch (final RestApiException e) {
throw new RestApiException("Could not delete destination " + destinationId, e);
}
......@@ -104,7 +103,7 @@ public class DestinationApiService implements DestinationService {
final String urlWithQueryParams = String.format(baseUrl + DESTINATION_ATTACHMENT_LIMITS_PATH, destinationId);
try {
final DestinationLimits destinationLimits = DestinationLimits.withChangeRequest(limitChangeRequest);
return httpClient.patch(urlWithQueryParams, buildHeaders(APPLICATION_JOSE), destinationLimits, DestinationLimits.class).getBody();
return httpClient.patch(urlWithQueryParams, buildHeaders(APPLICATION_JSON), destinationLimits, DestinationLimits.class).getBody();
} catch (final RestApiException e) {
throw new RestApiException("Could not send limit change request for destination " + destinationId, e);
}
......@@ -134,7 +133,7 @@ public class DestinationApiService implements DestinationService {
public void addKey(final UUID destinationId, ApiJwk apiJwk) {
final String urlWithQueryParams = String.format(baseUrl + DESTINATION_KEYS_PATH, destinationId);
try {
httpClient.post(urlWithQueryParams, buildHeaders(APPLICATION_JOSE), apiJwk, Void.class);
httpClient.post(urlWithQueryParams, buildHeaders(APPLICATION_JSON), apiJwk, Void.class);
} catch (final RestApiException e) {
throw new RestApiException("Could not add key " + apiJwk.getKid() + " to destination " + destinationId, e);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment