New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@dotcom-reliability-kit/serialize-request

Package Overview
Dependencies
Maintainers
5
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dotcom-reliability-kit/serialize-request - npm Package Compare versions

Comparing version 2.2.0 to 2.2.1

6

lib/index.d.ts

@@ -25,3 +25,3 @@ export = serializeRequest;

headers?: Headers | {
[x: string]: string;
[key: string]: string;
} | Iterable<[string, string]> | undefined;

@@ -32,6 +32,6 @@ method?: string | undefined;

type SerializedRequestHeaders = {
[x: string]: string;
[key: string]: string;
};
type SerializedRequestRouteParams = {
[x: string]: string;
[key: string]: string;
};

@@ -38,0 +38,0 @@ type SerializedRequestRoute = {

@@ -11,3 +11,3 @@ /**

* @typedef {object} BasicRequest
* @property {Headers | Object<string, string> | Iterable<[string, string]>} [headers]
* @property {Headers | {[key: string]: string} | Iterable<[string, string]>} [headers]
* The request HTTP headers.

@@ -26,3 +26,3 @@ * @property {string} [method]

* @typedef {object} SerializeRequestOptions
* @property {Array<string>} [includeHeaders]
* @property {string[]} [includeHeaders]
* An array of request headers to include.

@@ -32,7 +32,7 @@ */

/**
* @typedef {Object<string, string>} SerializedRequestHeaders
* @typedef {{[key: string]: string}} SerializedRequestHeaders
*/
/**
* @typedef {Object<string, string>} SerializedRequestRouteParams
* @typedef {{[key: string]: string}} SerializedRequestRouteParams
*/

@@ -66,3 +66,3 @@

* @public
* @type {Array<string>}
* @type {string[]}
*/

@@ -79,2 +79,10 @@ const DEFAULT_INCLUDED_HEADERS = [

/**
* The maximum length of a URL, any longer than this will be truncated.
*
* @private
* @type {number}
*/
const URL_TRUNCATION_LENGTH = 200;
/**
* Serialize a request object so that it can be consistently logged or output as JSON.

@@ -87,3 +95,3 @@ *

* `headers`, `method`, and `url` properties.
* @param {SerializeRequestOptions} [options = {}]
* @param {SerializeRequestOptions} [options]
* Options to configure the serialization.

@@ -130,5 +138,10 @@ * @returns {SerializedRequest}

// If set, request URL is cast to a string
// If set, request URL is cast to a string and truncated to avoid
// us exceeding log event size limits
if (request.url) {
requestProperties.url = `${request.url}`;
let url = `${request.url}`;
if (url.length > URL_TRUNCATION_LENGTH) {
url = url.slice(0, URL_TRUNCATION_LENGTH) + ' [truncated]';
}
requestProperties.url = url;
}

@@ -168,3 +181,3 @@

* The headers object to serialize.
* @param {Array<string>} includeHeaders
* @param {string[]} includeHeaders
* An array of request headers to include.

@@ -171,0 +184,0 @@ * @returns {SerializedRequestHeaders}

{
"name": "@dotcom-reliability-kit/serialize-request",
"version": "2.2.0",
"version": "2.2.1",
"description": "A utility function to serialize a request object in a way that's friendly to loggers, view engines, and converting to JSON",

@@ -19,4 +19,4 @@ "repository": {

"devDependencies": {
"@types/express": "^4.17.17"
"@types/express": "^4.17.18"
}
}

Sorry, the diff of this file is not supported yet

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