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

Support -F / --form in MultiPartFromDataRequest #120

Open
dariusz-wozniak opened this issue Feb 9, 2022 · 1 comment
Open

Support -F / --form in MultiPartFromDataRequest #120

dariusz-wozniak opened this issue Feb 9, 2022 · 1 comment

Comments

@dariusz-wozniak
Copy link

I'd like to translate the following cURL to the Tiny.RestClient request:

curl -v -u yourapikey:X -F "attachments[]=@/path/to/attachment1.ext" -F "attachments[]=@/path/to/attachment2.ext" -F "[email protected]" -F "subject=Ticket Title" -F "description=this is a sample ticket" -X POST 'https://domain.freshdesk.com/api/v2/tickets'

When I use the client to post the request:

var rs = await client.PostRequest("tickets")
                     .AsMultiPartFromDataRequest()
                     .AddString("[email protected]", "email")
                     .ExecuteAsStringAsync(CancellationToken.None);

...And I have a cURL listener (client.Settings.Listeners.AddCurl()), the translated cURL is (some data stripped off):

curl -X POST [...] -d "--1c3acb07-77bd-494d-bc56-21290dcd5088
Content-Type: text/plain
Content-Disposition: form-data; name=email

[email protected]
[...]

The "email" param is passed with the -d flag; how can I make the param passed by -F flag?

@dariusz-wozniak
Copy link
Author

The actual problem is Freshdesk API and its requirement to have parameters wrapped in quotation marks.

See the thread: restsharp/RestSharp#1744.

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