forked from auth0/auth0-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVoidRequest.java
More file actions
34 lines (29 loc) · 972 Bytes
/
VoidRequest.java
File metadata and controls
34 lines (29 loc) · 972 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package com.auth0.net;
import com.auth0.exception.Auth0Exception;
import com.fasterxml.jackson.core.type.TypeReference;
import okhttp3.OkHttpClient;
import okhttp3.Response;
import java.util.HashMap;
/**
* Represents a request that doesn't return any value on its success.
* <p>
* This class is not thread-safe:
* It makes use of {@link HashMap} for storing the parameters. Make sure to not modify headers or the parameters
* from a different or un-synchronized thread.
*
* @see CustomRequest
*/
public class VoidRequest extends CustomRequest<Void> {
public VoidRequest(OkHttpClient client, String url, String method) {
super(client, url, method, new TypeReference<Void>() {
});
}
@Override
protected Void parseResponse(Response response) throws Auth0Exception {
if (!response.isSuccessful()) {
throw super.createResponseException(response);
}
response.close();
return null;
}
}