Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-F form encoded values doesnt gets implemented #28

Open
vinchauhan opened this issue Oct 11, 2018 · 0 comments
Open

-F form encoded values doesnt gets implemented #28

vinchauhan opened this issue Oct 11, 2018 · 0 comments

Comments

@vinchauhan
Copy link

vinchauhan commented Oct 11, 2018

Are you requesting support for a new curl flag? If so, what is the flag and the equivalent Go code?

# curl -v -u admin:admin123 -X POST 'http://localhost:8081/service/rest/v1/components?repository=maven-releases' -F maven2.groupId=com.google.guava -F maven2.artifactId=guava -F maven2.version=24.0-jre -F [email protected] -F maven2.asset1.extension=jar -F [email protected] -F maven2.asset2.classifier=sources -F maven2.asset2.extension=jar

From Curl manual pages -

curl also supports the more capable
multipart/form-data type. This latter type supports things like file upload.

-F accepts parameters like -F "name=contents". If you want the contents to
be read from a file, use <@filename> as contents. When specifying a file,
you can also specify the file content type by appending ';type='
to the file name. You can also post the contents of several files in one
field. For example, the field name 'coolfiles' is used to send three files,
with different content types using the following syntax:

    curl -F "[email protected];type=image/gif,fil2.txt,fil3.html" \ 
         http://www.post.com/postit.cgi

If the content-type is not specified, curl will try to guess from the file
extension (it only knows a few), or use the previously specified type (from
an earlier file if several files are specified in a list) or else it will
use the default type 'application/octet-stream'.

Emulate a fill-in form with -F. Let's say you fill in three fields in a
form. One field is a file name which to post, one field is your name and one
field is a file description. We want to post the file we have written named
"cooltext.txt". To let curl do the posting of this data instead of your
favourite browser, you have to read the HTML source of the form page and
find the names of the input fields. In our example, the input field names
are 'file', 'yourname' and 'filedescription'.

    curl -F "[email protected]" -F "yourname=Daniel" \ 
         -F "filedescription=Cool text file with cool text inside" \ 
         http://www.post.com/postit.cgi
// (put Go code here
Repository owner deleted a comment from 030 May 31, 2019
Repository owner deleted a comment from 030 Jun 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant