Skip to content

Add a way to access all intercepted requests #4108

Closed
@gr2m

Description

@gr2m

This would solve...

Using intercepted requests for assertions.

My specific usecase is actions/create-github-app-token#217. In actions/create-github-app-token we define two interceptors centrally. We test by creating snapshots of the output of the action call. By logging out the intercepted requests here and here, the request options become part of the snapshot which allows us to prevent regressions and to confirm that our action behaves the correct way.

The implementation should look like...

Maybe something like this

mockPool.addListener('request', (requestOptions) => { ... })

An alternative could be a way to access all intercepted requests

const requests = mockAgent.interceptedRequests

I have also considered...

I tried a few things but nothing worked out for our use case.

Additional context

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