Framework: MakesHttpRequests::Call() makes `+` to spaces.

Created on 6 Apr 2017  路  1Comment  路  Source: laravel/framework

  • Laravel Version: 5.3.31 | 5.4
  • PHP Version: 7.1.0
  • PHPUnit Version: 4.8.35

Description:

When testing an API, the query parameters are not being encoded correctly, as parse_str decodes an url, which turns symbols like + into a (space).

This means when testing query data which has +, you get unexpected behaviour.
This issue might be Symfony related, as this is from Symfony Request line 417

A small test shows this is also related to current version of Laravel, as Call method is working the same way in 5.4 as in 5.3.

Steps To Reproduce:

  • Create a route and a test for it.
  • $this->getJson('route?filter=data+cool').
  • Look at the query parameters and see the + is now a (space).

Most helpful comment

+ in a query string represents a space, if you want a literal + you need to use %2B, I don't see how this is a bug.

>All comments

+ in a query string represents a space, if you want a literal + you need to use %2B, I don't see how this is a bug.

Was this page helpful?
0 / 5 - 0 ratings