Skip to content

Wrong type of ProxyResCallback (void instead of Promise<void>) #1151

@tobiw777

Description

@tobiw777

@chimurai I found same issue as @Floriferous. IMO his example is bad. To the point.
In your example:

  proxyRes: responseInterceptor(async (responseBuffer, proxyRes, req, res) => {
    const response = responseBuffer.toString('utf8'); // convert buffer to string
    return response.replace('Hello', 'Goodbye'); // manipulate response and return the result
  }),
},

event handler uses response interceptor which is an async but types of ProxyResCallback and ResponseInterceptor mismatch.
proxyRes?: httpProxy.ProxyResCallback<TReq, TRes>;
ProxyResCallback is void NOT Promise

Originally posted by @tobiw777 in #1139

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions