Vscode-restclient: Support multiline request body for x-www-form-urlencoded

Created on 28 Feb 2018  路  6Comments  路  Source: Huachao/vscode-restclient

  • VSCode Version: 1.11.2
  • OS Version: Win7
  • REST Client Version: 0.14.2

Hi,

thanks for this cool extension, it eases our quick testing so much! But one thing is a bit sticky.

One of our applications makes heavy use of post reqeusts with application/x-www-form-urlencoded bodies. This works pretty well, but all parameters need to be given in one line

arg0=val0&arg1=val1&arg2=val2

If there are many/long parameters, this makes it pretty ugly to keep track of the parameters. It would be nice to support multi lining of the parameters. I sneaked around in the code a bit and it seems that there is already a EOL normalization here: https://github.com/Huachao/vscode-restclient/blob/master/src/controllers/codeSnippetController.ts#L205
But I did not manage to get this triggered. My Request looks like this:

POST https://host:8443/my/path/to/endpoint HTTP/1.1
Content-Type: application/x-www-form-urlencoded

arg0=val0&arg1=val1&arg2=val2

Am I missing something, point me out. If not, it would be nice to support nice multi lines:

POST https://host:8443/my/path/to/endpoint HTTP/1.1
Content-Type: application/x-www-form-urlencoded

arg0=val0
&arg1=val1
&arg2=val2

Thanks
Fabian

enhancement

Most helpful comment

@fabianschlier @ashee @juunas11 @ljyf5593 @noark9 @jenan-stripe you can try the latest version 0.18.3 to verify this feature. The syntax follows what @fabianschlier described:

POST https://host:8443/my/path/to/endpoint HTTP/1.1
Content-Type: application/x-www-form-urlencoded

arg0=val0
&arg1=val1
&arg2=val2

All 6 comments

@fabianschlier I have implemented this feature, and will publish this in next release.

@fabianschlier @ashee @juunas11 @ljyf5593 @noark9 @jenan-stripe you can try the latest version 0.18.3 to verify this feature. The syntax follows what @fabianschlier described:

POST https://host:8443/my/path/to/endpoint HTTP/1.1
Content-Type: application/x-www-form-urlencoded

arg0=val0
&arg1=val1
&arg2=val2

@Huachao this works good. Thanks for adding this feature. Especially when working with big requests the files are readable much better now.

Is there a way to assign contents of a file to one of arguments? I can't manage to do it.

arg0=val0
&arg1=path_to_file.xml

I write like the in my request

Content-Type: application/x-www-form-urlencoded

I get that error

HTTP/1.1 400 Bad Request

{
"error": "unsupported_grant_type"
}

@fadl8 could you please show me your actual request?

Was this page helpful?
0 / 5 - 0 ratings