Skip to content

Abnormal response when using fixtureId #59

@MasterATM

Description

@MasterATM

Hello,
(I repost it in a new issue rather than the old one #54)

When autorecord stubs requests with responses of big size, it returns the path of the fixture in the response to the client (see #54) instead of the real content itself.

I am using autorecord 3.1.2 + Cypress 8.3.1.
The signature for res.send is different if we want to reply with either the direct response or a fixture.

If if modify the code to this, then it works:

            req.reply((res) => {
              const newResponse = sortedRoutes[method][url][index];
              if (newResponse.fixtureId) {
                res.send(
                  {
                        fixture: `${fixturesFolderSubDirectory}/${newResponse.fixtureId}.json`,
                        headers: newResponse.headers,
                        statusCode: newResponse.status
                  }
                );  
              } else {
                res.send(
                  newResponse.status,
                  newResponse.response,
                  newResponse.headers,
                );  
              }

Thanks.

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