Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -357,7 +357,7 @@ public void setShouldRedirect(@Nonnull IShouldRedirect shouldRedirect) {
*
* @return Callback which is called before redirect
*/
@Nullable
@Nonnull
public IShouldRedirect getShouldRedirect() {
return baseRequest.getShouldRedirect();
}
Expand All @@ -377,7 +377,7 @@ public void setShouldRetry(@Nonnull IShouldRetry shouldretry) {
*
* @return Callback called before retry
*/
@Nullable
@Nonnull
public IShouldRetry getShouldRetry() {
return baseRequest.getShouldRetry();
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/microsoft/graph/http/BaseRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ public void setShouldRedirect(@Nonnull IShouldRedirect shouldRedirect) {
*
* @return Callback which is called before redirect
*/
@Nullable
@Nonnull
public IShouldRedirect getShouldRedirect() {
return shouldRedirect;
}
Expand All @@ -557,7 +557,7 @@ public void setShouldRetry(@Nonnull IShouldRetry shouldretry) {
*
* @return Callback called before retry
*/
@Nullable
@Nonnull
public IShouldRetry getShouldRetry() {
return shouldRetry;
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/microsoft/graph/http/BaseStreamRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ public void setShouldRedirect(@Nonnull final IShouldRedirect shouldRedirect) {
*
* @return Callback which is called before redirect
*/
@Nullable
@Nonnull
public IShouldRedirect getShouldRedirect() {
return baseRequest.getShouldRedirect();
}
Expand All @@ -244,7 +244,7 @@ public void setShouldRetry(@Nonnull final IShouldRetry shouldretry) {
*
* @return Callback called before retry
*/
@Nullable
@Nonnull
public IShouldRetry getShouldRetry() {
return baseRequest.getShouldRetry();
}
Expand Down
10 changes: 8 additions & 2 deletions src/main/java/com/microsoft/graph/http/CoreHttpProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@
import okhttp3.ResponseBody;
import okio.BufferedSink;

import static com.microsoft.graph.httpcore.middlewareoption.RedirectOptions.DEFAULT_MAX_REDIRECTS;
import static com.microsoft.graph.httpcore.middlewareoption.RetryOptions.DEFAULT_DELAY;
import static com.microsoft.graph.httpcore.middlewareoption.RetryOptions.DEFAULT_MAX_RETRIES;

/**
* HTTP provider based off of OkHttp and msgraph-sdk-java-core library
*/
Expand Down Expand Up @@ -236,8 +240,10 @@ public <Result, Body> Request getHttpRequest(@Nonnull final IHttpRequest request
logger.logDebug("Starting to send request, URL " + requestUrl.toString());

// Request level middleware options
final RedirectOptions redirectOptions = request.getMaxRedirects() <= 0 ? null : new RedirectOptions(request.getMaxRedirects(), request.getShouldRedirect());
final RetryOptions retryOptions = request.getShouldRetry() == null ? null : new RetryOptions(request.getShouldRetry(), request.getMaxRetries(), request.getDelay());
final RedirectOptions redirectOptions = request.getMaxRedirects() == DEFAULT_MAX_REDIRECTS ? null
Comment thread
baywet marked this conversation as resolved.
Outdated
: new RedirectOptions(request.getMaxRedirects(), request.getShouldRedirect());
final RetryOptions retryOptions = (request.getMaxRetries() == DEFAULT_MAX_RETRIES && request.getDelay() == DEFAULT_DELAY) ? null
Comment thread
baywet marked this conversation as resolved.
Outdated
: new RetryOptions(request.getShouldRetry(), request.getMaxRetries(), request.getDelay());

final Request coreHttpRequest = convertIHttpRequestToOkHttpRequest(request);
Request.Builder corehttpRequestBuilder = coreHttpRequest
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/microsoft/graph/http/IHttpRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public interface IHttpRequest {
*
* @return Callback which is called before redirect
*/
@Nullable
@Nonnull
IShouldRedirect getShouldRedirect();

/**
Expand All @@ -134,7 +134,7 @@ public interface IHttpRequest {
*
* @return Callback called before retry
*/
@Nullable
@Nonnull
IShouldRetry getShouldRetry();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public RetryOptions(@Nullable final IShouldRetry shouldRetry, int maxRetries, lo
if(maxRetries < 0)
throw new IllegalArgumentException("Max retries cannot be negative");

this.mShouldretry = shouldRetry != null ? shouldRetry : DEFAULT_SHOULD_RETRY;
this.mShouldretry = shouldRetry == null ? DEFAULT_SHOULD_RETRY : shouldRetry;
this.mMaxRetries = maxRetries;
this.mDelay = delay;
}
Expand Down