🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@sebspark/openapi-e2e

Package Overview
Dependencies
Maintainers
4
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sebspark/openapi-e2e - npm Package Compare versions

Comparing version
1.1.0
to
1.1.1
+8
-0
CHANGELOG.md
# @sebspark/openapi-e2e
## 1.1.1
### Patch Changes
- 938d7b5: Updated express to fix CVE-2024-29041
- Updated dependencies [938d7b5]
- @sebspark/openapi-express@1.1.1
## 1.1.0

@@ -4,0 +12,0 @@

+2
-2
{
"name": "@sebspark/openapi-e2e",
"version": "1.1.0",
"version": "1.1.1",
"license": "Apache-2.0",

@@ -17,3 +17,3 @@ "private": false,

"@sebspark/openapi-express": "*",
"express": "4.18.2"
"express": "4.19.2"
},

@@ -20,0 +20,0 @@ "devDependencies": {

@@ -1,6 +0,6 @@

import type { Server } from 'http'
import type { Server } from 'node:http'
import { TypedClient } from '@sebspark/openapi-client'
import { Serialized } from '@sebspark/openapi-core'
import type { Serialized } from '@sebspark/openapi-core'
import { afterAll, beforeAll, describe, expect, it } from 'vitest'
import {
import type {
InstrumentEntityResponse,

@@ -53,2 +53,8 @@ MarketdataClient,

})
it('sends headers', async () => {
const result = await client.get('/secured', {
headers: { 'X-Api-Key': 'yo!', 'X-Client-Key': 'Hello' },
})
expect(result.data).toEqual('ok')
})
})

@@ -8,2 +8,32 @@ {

"paths": {
"/secured": {
"get": {
"summary": "Get a secure endpoint",
"parameters": [
{
"name": "X-Client-Key",
"in": "header",
"required": true,
"schema": {
"type": "string"
}
}
],
"security": [{ "ApiKey": [] }],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "string"
}
}
}
},
"403": { "$ref": "#/components/responses/Forbidden" },
"500": { "$ref": "#/components/responses/InternalServerError" }
}
}
},
"/markets": {

@@ -496,4 +526,11 @@ "get": {

}
},
"securitySchemes": {
"ApiKey": {
"in": "header",
"type": "apiKey",
"name": "X-Api-Key"
}
}
}
}
import {
ForbiddenError,
NotImplementedError,
PartiallySerialized,
type PartiallySerialized,
UnauthorizedError,
} from '@sebspark/openapi-core'
import { TypedRouter } from '@sebspark/openapi-express'
import express from 'express'
import {
Instrument,
import type {
InstrumentEntityResponse,

@@ -27,2 +28,12 @@ MarketListResponse,

const api: MarketdataServer = {
'/secured': {
get: {
handler: async ({ headers }) => {
console.log(headers)
if (!headers['x-client-key']) throw new UnauthorizedError()
if (!headers['x-api-key']) throw new ForbiddenError()
return [200, { data: 'ok' }]
},
},
},
'/instruments/:isin': {

@@ -29,0 +40,0 @@ get: {