I have to do the following task:
Please create a public http or https service. It must have a publicendpoint that accepts array of int32 numbers encoded as json in the request body and returns result as a number. Once deployed, pass the url of that endpoint to this service root in the request body as utf8 encoded string. If successful you will get a success code to give to us via upwork chat.
The URL I need to pass is: https://fast-api-test-app-f922f0fd9a50.herokuapp.com/
to this URL: http://194.182.164.40/ with X-auth (which I have but won't post here).
I have tried the following using httpie
:
http POST http://194.182.164.40/ x-auth:"....." url="https://fast-api-test-app-f922f0fd9a50.herokuapp.com/process"
but keep getting this error message:
parse "{\"url\": \"https://fast-api-test-app-f922f0fd9a50.herokuapp.com/process\"}": first path segment in URL cannot contain colon
How can I solve this?
Once deployed, pass the url of that endpoint to this service root in the request body as utf8 encoded string.
It says you're supposed to post only the URL itself. Not wrap it in JSON, and it doesn't say anything about calling the key "url"
or anything like it. So I suppose https://...
must be the only content of the request body.
In HTTPie, you can do that using the --raw
argument:
% http -v --raw="https://fast-api-test-app-f922f0fd9a50.herokuapp.com/" 194.182.164.40
POST / HTTP/1.1
Accept: application/json, */*;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 53
Content-Type: application/json
Host: 194.182.164.40
User-Agent: HTTPie/3.2.3
https://fast-api-test-app-f922f0fd9a50.herokuapp.com/