Skip to content

Commit

Permalink
Getting more detailed errors from FCM back-end service (#217)
Browse files Browse the repository at this point in the history
  • Loading branch information
hiranya911 committed Nov 21, 2018
1 parent 2e44eda commit d314964
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion CHANGELOG.md
@@ -1,7 +1,10 @@
# Unreleased

- [fixed] Fixing error handling in FCM. The SDK now checks the key
type.googleapis.com/google.firebase.fcm.v1.FcmError to set error code.
`type.googleapis.com/google.firebase.fcm.v1.FcmError` to set error
code.
- [fixed] FCM errors sent by the back-end now include more details
that are helpful when debugging problems.

# v6.5.0

Expand Down
Expand Up @@ -249,6 +249,7 @@ protected String execute() throws FirebaseMessagingException {
try {
HttpRequest request = requestFactory.buildPostRequest(
new GenericUrl(url), new JsonHttpContent(jsonFactory, payload.build()));
request.getHeaders().set("X-GOOG-API-FORMAT-VERSION", "2");
request.setParser(new JsonObjectParser(jsonFactory));
request.setResponseInterceptor(interceptor);
response = request.execute();
Expand Down
Expand Up @@ -512,6 +512,7 @@ private static HttpRequest checkRequestHeader(TestResponseInterceptor intercepto
assertEquals("POST", request.getRequestMethod());
assertEquals(TEST_FCM_URL, request.getUrl().toString());
assertEquals("Bearer test-token", request.getHeaders().getAuthorization());
assertEquals("2", request.getHeaders().get("X-GOOG-API-FORMAT-VERSION"));
return request;
}

Expand Down

0 comments on commit d314964

Please sign in to comment.