I'm running a flutter desktop app on linux and i need get the response from the following curl request
curl -sS --unix-socket /run/snapd.socket http://localhost/v2/snaps/ -X GET
I've got the process_run package installed so making the call is fairly straightfoward, i just dont know how to get the response from the call in to my dart code.
Related
My setup, I have a Win11 machine with WSL2 running docker, I have a container of my Laravel application that when making HTTP requests if the body is too big, it gives an error, but the error is generic, it doesn't say it's the size, see:
Laravel application error: cURL error 28: Operation timed out after 60001 milliseconds with 0 bytes received (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for "https://example.com".
So I made the request outside the application and the container, directly in WSL2 with Curl, command:
curl -v POST http://example.com -H "Content-Type: application/json" -d #test2.json
Command error on WSL2:
<h1>Bad request!</h1>
<p>
Your browser (or proxy) sent a request that
this server could not understand.
</p>
<p>
If you think this is a server error, please contact
the webmaster.
</p>
But I don't think it's the server/url/api, because if I make this request from anywhere else it works, for example through Postaman I sent a body 5 times bigger and it worked and if I run this same command in the terminal from Windows11 it works, same command and same body, but now running from outside WSL (windows cmd, same computer):
curl -v POST http://example.com -H "Content-Type: application/json" -d #test2.json works successfully.
What could it be? I've been looking for a solution for over 20 hours.
I want to get data from ServiceNow via a CURL in Putty via a Proxyserver (Plan is to implement it to a PySpark script later on) and then save the data onto the server.
My Command looks like this:
curl -x <proxyadress:port> -U proxyuser:proxypassword -u '<apiuser:apipassword>' -d status="message" "https:/apiadress" -H 'Accept: application/json'
I get the error message:
{"error":{"message":"Invalid content-type. Supported request media types for this service are: [application/json, application/xml, text/xml]","detail":null},"status":"failure"}
A few days ago I was able to have the data printed into the log but didn't manage to replicate the command ... what's wrong?
Thanks for your help
I am trying to automate file uploads to SharePoint Online. Problem is I keep getting 401 unauthorized error when trying to upload the files. I created a script to retrieve the token as suggested in curl request to Microsoft Sharepoint API?, but uploads are still failing, even though I do get a positive response when running curl -i -H "Authorization: Bearer $(./get_access_token.sh)" -H "Accept: application/json;odata=verbose" -s "https://YourTenant.sharepoint.com/_api/web". I have afeeling that I am just malforming my curl command. Any suggestion on command format to be using?
There is a problem with NodeJS v7.9.0 where there can be a request
curl -i -H Accept:application/json -H range:bytes=1-8 -X GET http://localhost:8080/examples/text.txt
However node's request header doesn't match when it is logged
console.log(req.headers.range)
The logged value varies between different values for the exact same request
(some values logged from that request: bytes=1-2, bytes=1-3, bytes=1-4, bytes=1-5, bytes=1-6, bytes=1, 7 bytes=1-8)
Is this a problem with NodeJS or something else with the computer's setup? And how does one fix it
Note the requests are being made with "Rest Web service client" (chrome plugin), and the request above is the equivalent curl command.
Inside a Dockerfile I try to download an artifact using curl. I have checked that although the artifact doesn't exist (thus getting a 404) the docker build keeps running.
RUN curl -H 'Cache-Control: no-cache' ${STANDALONE_LOCATION} -o $JBOSS_HOME/standalone/configuration/standalone.xml
Is there a way to check that the curl response code is 200 and throw an error otherwise?
You can add -f (or --fail) to the curl call, which causes curl to silently fail on server errors. From the curl manpage:
-f/--fail
(HTTP) Fail silently (no output at all) on server errors. This is mostly done to better enable scripts etc to better deal with failed attempts. In normal cases when a HTTP server fails to deliver a document, it returns an HTML document stating so (which often also describes why and more). This flag will prevent curl from outputting that and return error 22.
This method is not fail-safe and there are occasions where non-successful response codes will slip through, especially when authentication is involved (response codes 401 and 407).