7digital / SevenDigital.Api.Wrapper

A fluent c# wrapper for the 7digital API
MIT License
16 stars 29 forks source link

Support WithPayload and WithParameter for POSTs #232

Closed scooper91 closed 6 years ago

scooper91 commented 8 years ago

The RequestBuilder only supports using WithPayload or WithParameter. When parameters are provided the Payload is dropped out of the request.

In some circumstances it would be useful to be able to use both.

gregsochanik commented 8 years ago

Ah - not sure if this is a trivial fix as:

https://github.com/7digital/SevenDigital.Api.Wrapper/blob/master/src/SevenDigital.Api.Wrapper.Unit.Tests/Requests/RequestBuilderTests.cs#L87

shows that it may convert params to a post body by default (i.e. when no contenttype specified).

I'll try and write a test for a "querystring param passed and payload sent in application/json" use case, as there isn't one as far as I can see. Also, "when parameters are provided the Payload is dropped out of the request." sounds like a bug to me.

gregsochanik commented 8 years ago

Looks like the api itself does not support this as when attempting I get the following back from the api:

OAuth authentication error: Query string parameters are not permitted when performing HTTP Post. Please use Post body or header.