Skip to content

Commit 46e266b

Browse files
committed
fix AsyncJobMonitor#update() to work on Business drive
1 parent f34a30f commit 46e266b

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/main/java/com/bhyoo/onedrive/container/AsyncJobMonitor.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
import java.net.MalformedURLException;
1515
import java.net.URL;
1616

17+
import static io.netty.handler.codec.http.HttpHeaderNames.ACCEPT;
1718
import static io.netty.handler.codec.http.HttpHeaderNames.ACCEPT_ENCODING;
19+
import static io.netty.handler.codec.http.HttpHeaderValues.APPLICATION_JSON;
1820
import static io.netty.handler.codec.http.HttpHeaderValues.GZIP;
1921

2022
/**
@@ -37,9 +39,12 @@ public AsyncJobMonitor(@NotNull String url) {
3739

3840
@SneakyThrows(MalformedURLException.class)
3941
public AsyncJobMonitor update() {
40-
SyncResponse response = new SyncRequest(new URL(this.url)).setHeader(ACCEPT_ENCODING, GZIP).doGet();
42+
SyncResponse response = new SyncRequest(new URL(this.url))
43+
.setHeader(ACCEPT, APPLICATION_JSON)
44+
.setHeader(ACCEPT_ENCODING, GZIP)
45+
.doGet();
4146

42-
// TODO: handle error response
47+
// TODO: error handling
4348

4449
try {
4550
JsonParser parser = RequestTool.jsonFactory.createParser(response.getContent());
@@ -65,6 +70,9 @@ public AsyncJobMonitor update() {
6570
case "statusDescription":
6671
statusDescription = parser.getText();
6772
break;
73+
case "@odata.context":
74+
// TODO
75+
break;
6876
default:
6977
throw new IllegalStateException(
7078
"Unknown attribute detected in AsyncJobMonitor : " + currentName);

0 commit comments

Comments
 (0)