When the request parameter in HTTP is an array, when do I need to add square brackets [] to the parameter name?

Source: Internet
Author: User
Keywords Php java android http
Android (Retrofit) Request code

@FormUrlEncoded@POST("util/pinyin")Call> pinyin(@Field("lrcs[]") String[] lrcs);

For example, you can get the correct request result, and the ' @Field ("LRCs") ' server can only receive the last element of the array I sent out.
I caught my own bag to see that the confirmation was all contained in the post body sent out.

Is this the limit of the service-side parsing framework? Or is the HTTP protocol required? Or is it a formurlencoded limit?

Using square brackets (square brackets) + http/post do not find anything associated with the result.

Reply content:

Android (Retrofit) Request code

@FormUrlEncoded@POST("util/pinyin")Call> pinyin(@Field("lrcs[]") String[] lrcs);

For example, you can get the correct request result, and the ' @Field ("LRCs") ' server can only receive the last element of the array I sent out.
I caught my own bag to see that the confirmation was all contained in the post body sent out.

Is this the limit of the service-side parsing framework? Or is the HTTP protocol required? Or is it a formurlencoded limit?

Using square brackets (square brackets) + http/post do not find anything associated with the result.

Requirements for the HTTP protocol

When parsing parameters, the same key overwrites the previous one,
If the band [] is treated as a one-dimensional array, it will not overwrite the

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.