yongjhih/NotRetrofit

can't emit raw string into request?

Open

#9 opened on Dec 1, 2015

View on GitHub
 (1 comment) (0 reactions) (0 assignees)Java (11 forks)github user discovery
enhancementhelp wanted

Repository metrics

Stars
 (93 stars)
PR merge metrics
 (PR metrics pending)

Description

This is probably a strange request for a strange API that takes nonstandard JSON that had to be specially formatted.

Following this stackoverflow question: http://stackoverflow.com/questions/30515068/send-json-raw-object-retrofit

public class TypedJsonString extends TypedString {
    public TypedJsonString(String body) {
        super(body);
    }

    @Override public String mimeType() {
        return "application/json";
    }
}

The API looks like this:

    @POST("/fetch")
    public abstract AvailableCampaigns sendDataAndFetchCampaigns(
            @Retrofit.Header("User-Agent")
            String userAgent,
            @Retrofit.Query("Site_ID")
            String siteID,
            @Retrofit.Body
            TypedJsonString data);

I tried to use a TypedJsonString as well as a plain String but the LoganSquareConverter doesn't know how to handle either one. I just want a string passthru into the body. Any suggestions on how to do this?


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Contributor guide