Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
cypress-intercept-formdata
Advanced tools
cypress command to work with intreception's multipart/form-data requests
This package is intended to be used with Cypress.io intercept command.
As of version 6.3+ the request.body accessed from the intercept is an ArrayBuffer for multipart/form-data requests.
This makes it difficult to work with the body of the request and make assertions on it.
CIFD makes it easy to use the multipart body in your specs.
#Yarn:
$ yarn add cypress-intercept-formdata
#NPM:
$ npm i cypress-intercept-formdata
Add to your commands file:
//cypress/support/commands.js
import "cypress-intercept-formdata";
//...
Then in your spec:
cy.intercept("POST", "http://localhost:8888/api/test", {
statusCode: 200,
body: { success: true },
}).as(alias);
//...
cy.wait("@uploadRequest")
.interceptFormData((formData) => {
expect(formData["foo"]).to.eq("bar");
});
If you have file(s) uploaded as part of the request they will be available in the formData object as well: The value is the file name
cy.wait("@uploadRequest")
.interceptFormData((formData) => {
expect(formData["file"]).to.eq("fileName.txt");
});
Multiple files are also supported:
cy.wait("@uploadRequest")
.interceptFormData((formData) => {
expect(formData["file[0]"]).to.eq("fileName1.txt");
expect(formData["file[1]"]).to.eq("fileName2.txt");
});
FAQs
cypress command to work with Intercept multipart/form-data requests
The npm package cypress-intercept-formdata receives a total of 22,296 weekly downloads. As such, cypress-intercept-formdata popularity was classified as popular.
We found that cypress-intercept-formdata demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.