forked from getsentry/sentry-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRequestDetails.java
More file actions
36 lines (31 loc) · 1007 Bytes
/
RequestDetails.java
File metadata and controls
36 lines (31 loc) · 1007 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
35
36
package io.sentry;
import io.sentry.util.Objects;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import java.util.Map;
import org.jetbrains.annotations.NotNull;
/**
* Represents common HTTP request properties that must be set on the requests sending {@link
* SentryEnvelope}.
*/
public final class RequestDetails {
private final @NotNull URL url;
private final @NotNull Map<String, String> headers;
public RequestDetails(final @NotNull String url, final @NotNull Map<String, String> headers) {
Objects.requireNonNull(url, "url is required");
Objects.requireNonNull(headers, "headers is required");
try {
this.url = URI.create(url).toURL();
} catch (MalformedURLException e) {
throw new IllegalArgumentException("Failed to compose the Sentry's server URL.", e);
}
this.headers = headers;
}
public @NotNull URL getUrl() {
return url;
}
public @NotNull Map<String, String> getHeaders() {
return headers;
}
}