Bug in REST API Webhooks  Topic is solved

Discussions relating to the REST API of Jiwa 7.

Bug in REST API Webhooks

Postby SBarnes » Fri Mar 05, 2021 10:02 pm

There is a bug inside the code of the api that adds in the header to a webhook in that if the header is to specify a content type you get the error The 'Content-Type' header must be modified using the appropriate property or method.

The fix is to change the one line inside the loop that adds the headers from

Code: Select all
                                             webRequest.Headers[subscriptionRequestHeader.Name] = subscriptionRequestHeader.Value;



to

Code: Select all
                                          if(subscriptionRequestHeader.Name.ToUpper() == "CONTENT-TYPE")
                                          {
                                             webRequest.ContentType = subscriptionRequestHeader.Value;
                                          }
                                          else
                                          {
                                             webRequest.Headers[subscriptionRequestHeader.Name] = subscriptionRequestHeader.Value;
                                          }
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Bug in REST API Webhooks  Topic is solved

Postby Mike.Sheen » Sat Mar 06, 2021 12:42 pm

Thanks!

Logged as DEV-8635
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756

Re: Bug in REST API Webhooks

Postby SBarnes » Tue Mar 09, 2021 11:02 am

Hi Mike,

You might want to have a look at https://docs.microsoft.com/en-us/dotnet ... mework-4.8 and the remarks section as there are other headers you can't just set via the headers collection.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175


Return to REST API

Who is online

Users browsing this forum: No registered users and 3 guests

cron