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

JArray on Post #219

Closed
lukasroberts opened this issue May 2, 2016 · 2 comments
Closed

JArray on Post #219

lukasroberts opened this issue May 2, 2016 · 2 comments

Comments

@lukasroberts
Copy link

When trying to POST data to some custom endpoints such as the contact API that is not yet implemented with the existing client, i would like to post this kind of JSON

[ { "email": "jones@example.com", "last_name": "Jones", "pet": "Indiana", "age": 25 }, { "email": "miller@example.com", "last_name": "Miller", "pet": "FrouFrou", "age": 32 }, { "email": "invalid_email", "last_name": "Smith", "pet": "Spot", "age": 17 } ]

Given the POST method on the Client currently takes a JObject, this is not possible. I would like to submit a pull request with the change of refactoring the RequestAsync method on the client to look like this:

private async Task<HttpResponseMessage> RequestAsync(Methods method, string endpoint, object data)

And add another method for POST that takes a JArray as a parameter, like this:

public async Task<HttpResponseMessage> Post(string endpoint, JArray data) { return await RequestAsync(Methods.POST, endpoint, data); }

What is everyones thoughts on this? Would this be something you would consider?

@Jericho
Copy link

Jericho commented May 4, 2016

I already implemented this functionality in my fork and submitted a PR

@lukasroberts
Copy link
Author

Fair enough, hopefully it gets merged in soon then!

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

2 participants