Question

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****

**Moderation Team has archived post**

This post has been archived for educational purposes. Contents and links will no longer be updated. If you have the same/similar question, please write a new post.

Comments

Keep up to date on this post and subscribe to comments

September 3, 2018 - 4:58am

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.

September 3, 2018 - 5:25am
Response to AjayRangarh

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.

September 3, 2018 - 6:27am
Response to SurajAmin

Yes,you are correct @SurajAmin.If we are consuming then we can handle this using pyHttpResoponse code property's value.

September 3, 2018 - 10:07am
Response to VinayReddy7

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)

September 3, 2018 - 8:15am

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 

September 3, 2018 - 10:11am

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)

September 3, 2018 - 10:36am
Response to SurajAmin

you should not leave it as blank.

Based on response type, that has to be mapped.

September 8, 2018 - 11:13am

Hi,

Could you please explain why do you want to remove ?