I want to use the post request using my variables in Java with Unirest So, I have the request:
public void getToken() throws UnirestException, JSONException {
HttpResponse<JsonNode> request = Unirest.post(".../api/v1/login/")
.header("Accept", "application/json")
.body("identity=loginValue&password=passwordValue")
.asJson();
But I have a stack of login/password pairs for the different tests. So I want to use something like this:
.body("identity="+loginVariable+"&password="+passwordVariable)
But there is some problem because my variables are keeping in email format (example@domain.com) But in HTTP the At Sign (@) replaced with %40 so I should store my variables in format (example%40domain.com) but it will be uncomfortable because of I using these variables in other tests where they should include @ sign.
Of course, I can create another stack of variables with %40 instead of @, but maybe you can suggest me how to fix my Unirest request to work with @
Aucun commentaire:
Enregistrer un commentaire