Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@tuchuang.space/mock-server

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tuchuang.space/mock-server - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

7

app.js

@@ -38,3 +38,8 @@ const express = require('express')

expressApp.all('*', upload.array('images'), (req, res, next) => {
expressApp.all('*', (req, res, next) => {
res.setHeader('Access-Control-Allow-Origin', '*')
res.setHeader('Access-Control-Allow-Headers', '*')
res.setHeader('Access-Control-Allow-Methods', 'post, get, options')
next()
}, upload.array('images'), (req, res, next) => {
requestsData.push(req)

@@ -41,0 +46,0 @@ res.send(response.body)

@@ -45,2 +45,12 @@ /* eslint-env jest */

it('当发起任何请求的时候, 需要返回允许跨域的头', async () => {
// act
const response = await request(app)
.get('/api/v1/images?param=1')
// assert
expect(response.header['access-control-allow-origin']).toEqual('*')
expect(response.header['access-control-allow-headers']).toEqual('*')
expect(response.header['access-control-allow-methods']).toEqual('post, get, options')
})
describe('搜索 request', () => {

@@ -47,0 +57,0 @@ afterEach(() => {

2

package.json

@@ -12,3 +12,3 @@ {

"description": "一个 server 模拟工具, 可配置响应, 获取某个请求是否接收到了",
"version": "0.1.0",
"version": "0.2.0",
"main": "index.js",

@@ -15,0 +15,0 @@ "scripts": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc