curl / Mailing Lists / curl-users / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

AW: AW: curl -d in powershell

From: Oeckinghaus, Christian via curl-users <curl-users_at_lists.haxx.se>
Date: Tue, 29 Mar 2022 13:13:14 +0000

I'm trying to use a REST service using Windows mingw/curl. GET works nicely on that REST service (HTTP 200), but not POST. If I'm using Linux/curl, everything works nicely and I get HTTP 200 for both GET and POST. Using Windows mingw/curl, I always get HTTP 302 if using POST. Unfortunately, I need to get it working on Windows. I tried different variations of using -d parameter as I wrote before, but no avail. First sample is adapted from swagger UI for REST services. CRLF is removed from somefile in second sample

Sample 1
.\bin\curl -v -X 'POST' `
  'http://someurl' `
  -H 'accept: application/xml' `
  -H 'Content-Type: application/xml' `
  -d '<?xml version="1.0" encoding="utf-8"?>
<tns:someelement xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
                             xmlns:tns="http://someurl" >
        <tns:name>Test Eins</tns:name>
</tns:someelement>'

Sample 2
.\bin\curl -v -X 'POST' `
  'http://someurl' `
  -H 'accept: application/xml' `
  -H 'Content-Type: application/xml' `
  -d '_at_somefile'



On Mon, 28 Mar 2022, Oeckinghaus, Christian via curl-users wrote:

> I'm using the real curl, downloaded it from haxx.se.

Then please show us what curl says when you run

   curl -v -d _at_filename https://urldefense.com/v3/__https://httpbin.org/post__;!!AaIhyw!5kzE9ueEWYW-n4bKxvA3K7qCwmcxiqfODBr9SnJBhPaiid5YvB2GUj0Wx6qUMz3nnuYq7g$

Make 'filename' a small file with some simple text content, for testing.

-- 
  / daniel.haxx.se
  | Commercial curl support up to 24x7 is available!
  | Private help, bug fixes, support, ports, new features
  | https://urldefense.com/v3/__https://curl.se/support.html__;!!AaIhyw!5kzE9ueEWYW-n4bKxvA3K7qCwmcxiqfODBr9SnJBhPaiid5YvB2GUj0Wx6qUMz2E4s_M5Q$ 
-- 
Unsubscribe: https://lists.haxx.se/listinfo/curl-users
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2022-03-29