Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Now i`m adding array as string to body:

RequestBody body = new FormEncodingBuilder()
    .add("profiles", "[122, 125, 336]")
    .build();

But the server need array on post parameter. How can i add array instead of string? Is it posible with okhttp?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
539 views
Welcome To Ask or Share your Answers For Others

1 Answer

You are currently posting profiles as a string. You will want to mimic a POST for a checkbox form field for profiles

RequestBody body = new FormEncodingBuilder()
    .add("profiles[0]", "122")
    .add("profiles[1]", "125")
    .add("profiles[2]", "336")
    .build();

more info and good reading,


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...