Pieter Verschragen
Pieter Verschragen

Reputation: 43

Firebase x-http-method-override parameter ignored

HTTP POST requests using ?x-http-method-override=PATCH are being processed as POST instead of PATCH calls on the Firebase REST API. This has started happening some time in the last two weeks.

The Firebase documentation still mentions this parameter, is this no longer accurate or is this a bug in Firebase?

The specific (Java) code runs on Google Appengine where PATCH is not directly supported. (Predating the App Engine compatible Firebase SDK)

For reference, the request is made with the following code, the response indicates a succesful request without any errors.

HttpRequestFactory requestFactory = HTTP_TRANSPORT.createRequestFactory(new 
HttpRequestInitializer() {
    @Override
    public void initialize(HttpRequest request) {
        request.setParser(new JsonObjectParser(JSON_FACTORY));
    }
});
String path = url+".json"+"?x-http-method-override=PATCH";
GenericUrl fullUrl = new GenericUrl(path);

JsonHttpContent content = new JsonHttpContent(JSON_FACTORY, data);
content.setMediaType(new HttpMediaType("application/json; charset=UTF-8"));
HttpRequest request = requestFactory.buildPostRequest(fullUrl,content);
HttpResponse response = request.execute();

Upvotes: 3

Views: 744

Answers (1)

Frank van Puffelen
Frank van Puffelen

Reputation: 599216

firebaser here

This issue was unfortunately recently introduced into Firebase's server-side handling of REST requests. We expect to have a fix out by June 1st.

Until that time you'll have to pass the proper HTTP verb or a request header to get the PATCH behavior. Sorry I don't have better news for now.

Upvotes: 2

Related Questions