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

@nestia/fetcher

Package Overview
Dependencies
Maintainers
1
Versions
466
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nestia/fetcher - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0-dev.20230413

25

lib/HttpError.d.ts

@@ -21,2 +21,27 @@ /**

constructor(method: "GET" | "DELETE" | "POST" | "PUT" | "PATCH", path: string, status: number, message: string);
/**
* `HttpError` to JSON.
*
* When you call `JSON.stringify()` function on current `HttpError` instance,
* this `HttpError.toJSON()` method would be automatically called.
*
* Also, if response body from the remote HTTP server forms a JSON object,
* this `HttpError.toJSON()` method would be useful because it returns the
* parsed JSON object about the {@link message} property.
*
* @template T Expected type of the response body.
* @returns JSON object of the `HttpError`.
*/
toJSON<T>(): HttpError.IProps<T>;
}
export declare namespace HttpError {
/**
* Returned type of {@link HttpError.toJSON} method.
*/
interface IProps<T> {
method: "GET" | "DELETE" | "POST" | "PUT" | "PATCH";
path: string;
status: number;
message: T;
}
}

@@ -42,2 +42,6 @@ "use strict";

_this.status = status;
/**
* @internal
*/
_this.body_ = NOT_YET;
// INHERITANCE POLYFILL

@@ -51,5 +55,29 @@ var proto = _newTarget.prototype;

}
/**
* `HttpError` to JSON.
*
* When you call `JSON.stringify()` function on current `HttpError` instance,
* this `HttpError.toJSON()` method would be automatically called.
*
* Also, if response body from the remote HTTP server forms a JSON object,
* this `HttpError.toJSON()` method would be useful because it returns the
* parsed JSON object about the {@link message} property.
*
* @template T Expected type of the response body.
* @returns JSON object of the `HttpError`.
*/
HttpError.prototype.toJSON = function () {
if (this.body_ === NOT_YET)
this.body_ = JSON.parse(this.message);
return {
method: this.method,
path: this.path,
status: this.status,
message: this.body_,
};
};
return HttpError;
}(Error));
exports.HttpError = HttpError;
var NOT_YET = {};
//# sourceMappingURL=HttpError.js.map

2

package.json
{
"name": "@nestia/fetcher",
"version": "1.0.1",
"version": "1.1.0-dev.20230413",
"description": "Fetcher library of Nestia SDK",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -10,2 +10,7 @@ /**

/**
* @internal
*/
private body_: any = NOT_YET;
/**
* Initializer Constructor.

@@ -31,2 +36,38 @@ *

}
/**
* `HttpError` to JSON.
*
* When you call `JSON.stringify()` function on current `HttpError` instance,
* this `HttpError.toJSON()` method would be automatically called.
*
* Also, if response body from the remote HTTP server forms a JSON object,
* this `HttpError.toJSON()` method would be useful because it returns the
* parsed JSON object about the {@link message} property.
*
* @template T Expected type of the response body.
* @returns JSON object of the `HttpError`.
*/
public toJSON<T>(): HttpError.IProps<T> {
if (this.body_ === NOT_YET) this.body_ = JSON.parse(this.message);
return {
method: this.method,
path: this.path,
status: this.status,
message: this.body_,
};
}
}
export namespace HttpError {
/**
* Returned type of {@link HttpError.toJSON} method.
*/
export interface IProps<T> {
method: "GET" | "DELETE" | "POST" | "PUT" | "PATCH";
path: string;
status: number;
message: T;
}
}
const NOT_YET = {} as any;

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