Is it possible to rewrite a status code with Charles Proxy?

后端 未结 6 819
刺人心
刺人心 2021-01-30 15:57

I\'m using Charles Proxy to rewrite a response from an API for testing purpose.

If I set a breakpoint, I am allowed to completely rewrite the raw response as I wish.

6条回答
  •  一向
    一向 (楼主)
    2021-01-30 16:40

    Using Charles 3.8+, you can rewrite the status code.

    In the rewrite tool, select "Type: response status". In the match fields and replace fields, be aware that Charles expects the incoming and rewritten statuses to match the format "\d{3} .*". This means that your rewritten status must have a message portion in addition to the numeric status code.

    For example:

    Match value: 201 .*

    Replace value: 502 Bad Gateway

    Omitting the message from the replace value will result in no rewrite of the status line. You can see Charles' rewrite tool output messages in the Notes section of each call's summary.

提交回复
热议问题