Skip to content
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
4 changes: 3 additions & 1 deletion src/main/java/org/kohsuke/github/GHNotificationStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,9 @@ GHThread fetch() {
Thread.sleep(waitTime);
}

req.setHeader("If-Modified-Since", lastModified);
if (lastModified != null) {
req.setHeader("If-Modified-Since", lastModified);
}

Requester requester = req.withUrlPath(apiUrl);
GitHubResponse<GHThread[]> response = ((GitHubPageContentsIterable<GHThread>) requester
Expand Down
1 change: 1 addition & 0 deletions src/test/java/org/kohsuke/github/AppTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1709,6 +1709,7 @@ public void notifications() throws Exception {
}
assertThat(found, is(true));
gitHub.listNotifications().markAsRead();
gitHub.listNotifications().iterator().next();
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"message": "Unable to parse If-Modified-Since request header. Please make sure value is in an acceptable format.",
"documentation_url": "https://docs.github.com/rest/activity/notifications#list-notifications-for-the-authenticated-user",
"status": "422"
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@
"X-XSS-Protection": "1; mode=block",
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
"Content-Security-Policy": "default-src 'none'",
"X-GitHub-Request-Id": "CB13:833E:A1F759:BFE352:5DB3A151",
"Link": "<https://api.github.com/notifications?page=2>; rel=\"next\", <https://api.github.com/notifications?page=5>; rel=\"last\""
"X-GitHub-Request-Id": "CB13:833E:A1F759:BFE352:5DB3A151"
}
},
"uuid": "ac22e3e2-f0d3-4ff1-af23-23e9c79c725c",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"id": "ac22e3e2-f0d3-4ff1-af23-23e9c7915874",
"name": "notifications",
"request": {
"url": "/notifications",
"method": "GET",
"headers": {
"Accept": {
"equalTo": "application/vnd.github+json"
},
"If-Modified-Since":{
"equalTo": "null"
}
}
},
"response": {
"status": 422,
"bodyFileName": "27-notifications.json",
"headers": {
"Date": "Wed, 20 Nov 2024 13:55:23 GMT",
"Content-Type": "application/json; charset=utf-8",
"X-OAuth-Scopes": "repo",
"X-Accepted-OAuth-Scopes": "notifications, repo",
"X-GitHub-Media-Type": "github.v3; format=json",
"x-github-api-version-selected": "2022-11-28",
"X-RateLimit-Limit": "5000",
"X-RateLimit-Remaining": "4992",
"X-RateLimit-Reset": "1732111985",
"X-RateLimit-Used": "8",
"X-RateLimit-Resource": "core",
"Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset",
"Access-Control-Allow-Origin": "*",
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
"X-Frame-Options": "deny",
"X-Content-Type-Options": "nosniff",
"X-XSS-Protection": "0",
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
"Content-Security-Policy": "default-src 'none'",
"Vary": "Accept-Encoding, Accept, X-Requested-With",
"Server": "github.com",
"X-GitHub-Request-Id": "052F:2E353B:3FE0C:42EBB:673DEA4B"
}
},
"uuid": "ac22e3e2-f0d3-4ff1-af23-23e9c7915874",
"persistent": true,
"insertionIndex": 26
}