Beast: How do you add a custom parameter to a request?

Created on 19 Nov 2018  路  6Comments  路  Source: boostorg/beast

Hi,

How do you add a parameter to a request?
I am using java (spring) for the server side. And this server requests parameter named "path".
I created a request called req then i tried this: req.insert("path", "path/to/file");.
But the server still complains that it doesn't find a parameter called "path".

Most helpful comment

Hi @neel Vinnie is working on the boost.url library as we speak. It will be released as a separate library rather than part of boost.beast.

In the meantime, there are a number of uri-parsing libraries out there.

One I have used in the past is the c library uriparser:

https://github.com/uriparser/uriparser

You can track the progress of boost.url here:

https://github.com/vinniefalco/url

All 6 comments

Are you talking about URI parameters? Or are you talking about HTTP fields? URI parameters go at the end of the target string, for example GET /?path=path/to/file HTTP/1.1 you will need to handle your own URL encoding for this as well.

I needed an URI parameter apparently, thanks for the quick response! :)

URI parameters go at the end of the target string

I wish there was a more convenient way to do this (boost::uri? boost::beast::uri?).

I wish there was a more convenient way to do this (boost::uri? boost::beast::uri?).

Me too! I will get around to adding beast::uri eventually...

Any updates on this issue ?
I am trying to extract uri and the get query parameters from the request.

Hi @neel Vinnie is working on the boost.url library as we speak. It will be released as a separate library rather than part of boost.beast.

In the meantime, there are a number of uri-parsing libraries out there.

One I have used in the past is the c library uriparser:

https://github.com/uriparser/uriparser

You can track the progress of boost.url here:

https://github.com/vinniefalco/url

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nguoithichkhampha picture nguoithichkhampha  路  7Comments

shuras109 picture shuras109  路  6Comments

clekby picture clekby  路  7Comments

vchang-akamai picture vchang-akamai  路  5Comments

monada99 picture monada99  路  5Comments