Skip to content

Commit 72df8da

Browse files
committed
- improves batches replacement by using regex saving compute
1 parent d0fbb70 commit 72df8da

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/main/java/com/microsoft/graph/content/MSBatchRequestContent.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,7 @@ private JsonObject getBatchRequestObjectFromRequestStep(final MSBatchRequestStep
118118
contentmap.add("id", new JsonPrimitive(batchRequestStep.getRequestId()));
119119

120120
final String url = batchRequestStep.getRequest().url().toString()
121-
.replaceAll("https://graph.microsoft.com/v1.0/", "").replaceAll("http://graph.microsoft.com/v1.0/", "")
122-
.replaceAll("https://graph.microsoft.com/beta/", "").replaceAll("http://graph.microsoft.com/beta/", "");
121+
.replaceAll("(?i)^http[s]?:\\/\\/graph\\.microsoft\\.com\\/(?>v1\\.0|beta)\\/?", ""); // (?i) case insensitive
123122
contentmap.add("url", new JsonPrimitive(url));
124123

125124
contentmap.add("method", new JsonPrimitive(batchRequestStep.getRequest().method().toString()));

0 commit comments

Comments
 (0)