Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Abnormal response when using fixtureId #59

Open
MasterATM opened this issue Sep 24, 2021 · 1 comment
Open

Abnormal response when using fixtureId #59

MasterATM opened this issue Sep 24, 2021 · 1 comment

Comments

@MasterATM
Copy link

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.

@kkhaidukov
Copy link

@MasterATM would you mind to create a PR out of this? I'm experiencing the same issue, and your suggestion does indeed solve it for me locally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants