Skip to content
This repository was archived by the owner on Aug 30, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public static AsyncConnection create(SentryOptions options) {

// TODO: Take configuration values from SentryOptions
HttpTransport transport =
new HttpTransport(options, null, setCredentials, 5000, 5000, false, sentryUrl);
new HttpTransport(options, setCredentials, 5000, 5000, false, sentryUrl);

// TODO this should be made configurable at least for the Android case where we can
// just not attempt to send if the device is offline.
Expand Down
10 changes: 10 additions & 0 deletions sentry-core/src/main/java/io/sentry/core/SentryOptions.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.sentry.core;

import io.sentry.core.util.NonNull;
import java.net.Proxy;
import java.util.ArrayList;
import java.util.List;

Expand All @@ -21,6 +22,7 @@ public class SentryOptions {
private BeforeSendCallback beforeSend;
private BeforeBreadcrumbCallback beforeBreadcrumb;
private String cacheDirPath;
private Proxy proxy;

public void addEventProcessor(EventProcessor eventProcessor) {
eventProcessors.add(eventProcessor);
Expand Down Expand Up @@ -129,6 +131,14 @@ public void setCacheDirPath(String cacheDirPath) {
this.cacheDirPath = cacheDirPath;
}

public Proxy getProxy() {
return proxy;
}

public void setProxy(Proxy proxy) {
this.proxy = proxy;
}

public interface BeforeSendCallback {
SentryEvent execute(SentryEvent event);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public class HttpTransport implements ITransport {
* obtained from the options.
*
* @param options sentry options to read the config from
* @param proxy the proxy to use, if any
* @param connectionConfigurator this consumer is given a chance to set up the request before it
* is sent
* @param connectionTimeoutMills connection timeout in milliseconds
Expand All @@ -46,13 +45,12 @@ public class HttpTransport implements ITransport {
*/
public HttpTransport(
SentryOptions options,
@Nullable Proxy proxy,
IConnectionConfigurator connectionConfigurator,
int connectionTimeoutMills,
int readTimeoutMills,
boolean bypassSecurity,
URL sentryUrl) {
this.proxy = proxy;
this.proxy = options.getProxy();
this.connectionConfigurator = connectionConfigurator;
this.serializer = options.getSerializer();
this.connectionTimeout = connectionTimeoutMills;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ class HttpTransportTest {
fun getSUT(): HttpTransport {
val options = SentryOptions()
options.serializer = serializer
options.proxy = proxy

return object : HttpTransport(options, proxy, requestUpdater, connectionTimeout, readTimeout, bypassSecurity, dsn) {
return object : HttpTransport(options, requestUpdater, connectionTimeout, readTimeout, bypassSecurity, dsn) {
override fun open(url: URL?, proxy: Proxy?): HttpURLConnection {
return connection
}
Expand Down