Skip to content
This repository has been archived by the owner on Oct 18, 2018. It is now read-only.

Creating an array in CreateWebHookRequest instead of a JSon object #115

Closed
divad4686 opened this issue Feb 13, 2017 · 3 comments
Closed

Comments

@divad4686
Copy link

divad4686 commented Feb 13, 2017

I'm building a Webhook provider library, and one of the requirements I have is to change the default Webhook request body. I can do this by overriding the CreateWebHookRequestBody in the WebHookSender class.

The problem is that my request body have to be wrapper in an array ( it is a requirement for Rest Hooks in Zapier) but the functions CreateWebHookRequest, CreateWebHookRequestBody and SignWebHookRequest all work with JObject class, making it impossible to wrap the body in an array.

I fixed this by overriding the 3 functions in my own class, but most of the work was copy-pasting the default implementation, replacing JObject for JContainer and using JArray.FromObject in CreateWebHookRequestBody.

I think I could do a pull request here in the project with this commit so people will have it easy later to use JArray or JObject in their own implementations. This should not have any side effect, since in the end, outside CreateWebHookRequestBody, all it is done with this object is a. .ToString()

The only problem I could see is that it would not compile the project for people that already override CreateWebHookRequestBody

@hybridtechie
Copy link

It's much easier to use Zapier scripting and wrapping the response in an array.

@dougbu dougbu added this to the Backlog milestone Jan 17, 2018
@dougbu
Copy link
Member

dougbu commented Jan 17, 2018

We've moved this issue to the Backlog milestone. This means that it is not going to happen for the coming release. We will reassess the backlog following the current release and consider this item at that time. However, keep in mind that there are many other high priority features with which it will be competing for resources.

Have also marked this issue as up-for-grabs. This means we will review a PR filling this gap if someone submits one.

In this particular case, the PR should avoid breaking changes and continue to support those who have overridden the existing methods. Add new wrapper methods e.g. CreateWebHookRequestBodyContainer(...) and call the existing overloads. Then use the new wrappers in CreateWebHookRequest(...).

@aspnet-hello
Copy link

This issue was moved to aspnet/AspNetWebHooks#24

@aspnet aspnet locked and limited conversation to collaborators Mar 13, 2018
@aspnet-hello aspnet-hello removed this from the Backlog milestone Mar 13, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants