How to add extra header like access_token : jshaj_some_really_long_token
and also set content-type to Content-Type: application/json
in warp post call?
Scenario in detail:
- I want to create API using warp say the end point is
https://example.com/orders
- The type is post which needs a payload =>
'{ "myid" : 12 , "price" : 23.2, "transaction" : "buy", "quantity" : 10 }'
- Now I want to use
reqwest
or any in builtwarp
http
client to send a request to another server endpoint sayhttps://api.example.com/orders
with the above post payload but with the new header which isContent-Type: application/json
andaccess-token: jshaj_some_really_long_token
Please do share if there are some examples which are using warp and reqwest for post requests. Currently I am referring this
You can use the
warp-reverse-proxy
crate for that (maintainer here :) )You would have to compose the utilities inside to modify what you need as per the example:
Notice that the forwarding of the request is done by the lib, if you actually want examples you can check the source code to investigate how it is done.