Is it possible to remove the Content-Type (text;charset=UTF-8) in a 401 Unauthorized REST Service Response
Hi,
One of our clients consuming our REST service have requested that we remove the Content-Type (text;charset=UTF-8) when there is an authorization failure (401) from the Response as it doesn't actually contain any body.
Is this possible?
Thanks.
regards,
Suraj
Kind
***Edited by Moderator Marissa to update platform capability tags****
-
Like (0)
-

Hi Suraj,
I don't think this is supported out of the box. It might be possible by using an activity to get the response and then setting it accordingly.

If there is a auth failure - do you even get an opportunity to invoke an activity? I presumed it was handled directly by Pega. It would be great if you/someone can guide on how to invoke an activity when there is a auth failure.
Yes,you are correct @SurajAmin.If we are consuming then we can handle this using pyHttpResoponse code property's value.
Not sure I understand. I checked pyHTTPResponseCode and it looks like its used to set the HTTP Response code (200, 401, etc) - I was looking into how I can skip the content-type in the response when there is a 401 (auth failure)

Hi Suraj,
Please check the content tyoe field in reponse tab of our rest rule. This issue mainly happens if the type is text/html.
If you are sending JSON as response, try selecting application/json and execute.
Hope this helps you.
Thanks,
Divya Sri Padarthy
When I add a Security-Error condition to the response (see attached screenshot) - I can't seem to leave the Content type field blank even though there is nothing mapped in the Message data (section below)

you should not leave it as blank.
Based on response type, that has to be mapped.

Hi,
Could you please explain why do you want to remove ?