playframework / playframework/play-ws

Order of Form Parameters is not preserved (application/x-www-form-urlencoded)

Open
#447 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

triage
Dominant language
Scala
Stars
224
Forks
92
Avg merge
1d 19h
Merged PRs (30d)
28

Description

Play WS Version (2.7.2 / etc)
JAVA

In StandaloneAhcWSRequest the order of Form-Parameters is not preserved:


                    // XXX shouldn't the encoding be same as charset?
                    Map<String, List<String>> stringListMap = FormUrlEncodedParser.parseAsJava(stringBody, "utf-8");
                    stringListMap.forEach((key, values) -> values.forEach(value -> builder.addFormParam(key, value)));

"FormUrlEncodedParser.parseAsJava" does not preserver the order, and "stringListMap" is unordered.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in StandaloneAhcWSRequest at the FormUrlEncodedParser.parseAsJava call and trace how stringListMap is populated before builder.addFormParam is called. Verify the behavior with form parameters whose input order differs from map ordering; done means the encoded request preserves the original parameter order.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.