Skip to content

Removing Rest Request Headers #959

Closed
@nilesh-shah

Description

@nilesh-shah

Is there a way by which I can remove the header value from RestSharp request.
Ex. I have added token in the request header and after request execution realized that, token is expired. I wanted to apply regenerated to token to request. If I simply add it using AddHeader, it creates a new parameter entry with same name, and does not override the earlier one.

Looking for a way where either i can remove and add or update header.

If this is not supported,

  1. one can enumerate the parameters and find a parameter by parameter type and name
  2. once found, remove it from Parameters list (using List.Remove)
  3. Then, add it again

I can generate PR by exposing the method. Please suggest if this is good to have feature in the library.

Thanks
Nilesh

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions