Skip to content

Allow applying middleware before know about request uri and methods #126

@iEricKoh

Description

@iEricKoh

Currently the middleware function is under Request.

I am trying to create and reuse a client, a sign will be calculated base on the url path and query.
Is it possible that I can create a http client with applied middleware before know about any uri and http methods?

Basically it's request/response interceptor.

for example:

let client = surf::Client::new();
let client = client.middleware(...)  // no middleware func exist in the client

let request = Request { client }

// the middleware func will be executed before sending out the request
request.client.get("https://httpbin.org/get").recv_string(); 

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions