Socket
Socket
Sign inDemoInstall

builder-util-runtime

Package Overview
Dependencies
Maintainers
1
Versions
99
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

builder-util-runtime - npm Package Compare versions

Comparing version 3.2.0 to 3.3.0

7

out/httpExecutor.d.ts

@@ -17,6 +17,7 @@ /// <reference types="node" />

}
export declare function createHttpError(response: IncomingMessage, description?: any | null): HttpError;
export declare class HttpError extends Error {
readonly response: IncomingMessage;
description: any | null;
constructor(response: IncomingMessage, description?: any | null);
readonly statusCode: number;
readonly description: any | null;
constructor(statusCode: number, message?: string, description?: any | null);
}

@@ -23,0 +24,0 @@ export declare function parseJson(result: Promise<string | null>): Promise<any>;

@@ -7,2 +7,3 @@ "use strict";

exports.DigestTransform = exports.HttpExecutor = exports.HttpError = undefined;
exports.createHttpError = createHttpError;
exports.parseJson = parseJson;

@@ -55,6 +56,10 @@ exports.configureRequestOptionsFromUrl = configureRequestOptionsFromUrl;

const debug = (0, _debug2.default)("electron-builder");
function createHttpError(response, description = null) {
return new HttpError(response.statusCode || -1, `${response.statusCode} ${response.statusMessage}` + (description == null ? "" : "\n" + JSON.stringify(description, null, " ")) + "\nHeaders: " + safeStringifyJson(response.headers), description);
}
const HTTP_STATUS_CODES = new Map([[429, "Too many requests"], [400, "Bad request"], [403, "Forbidden"], [404, "Not found"], [405, "Method not allowed"], [406, "Not acceptable"], [408, "Request timeout"], [413, "Request entity too large"], [500, "Internal server error"], [502, "Bad gateway"], [503, "Service unavailable"], [504, "Gateway timeout"], [505, "HTTP version not supported"]]);
class HttpError extends Error {
constructor(response, description = null) {
super(response.statusCode + " " + response.statusMessage + (description == null ? "" : "\n" + JSON.stringify(description, null, " ")) + "\nHeaders: " + JSON.stringify(response.headers, null, " "));
this.response = response;
constructor(statusCode, message = `HTTP error: ${HTTP_STATUS_CODES.get(statusCode) || statusCode}`, description = null) {
super(message);
this.statusCode = statusCode;
this.description = description;

@@ -113,3 +118,3 @@ this.name = "HttpError";

// error is clear, we don't need to read detailed error description
reject(new HttpError(response, `method: ${options.method} url: ${options.protocol || "https:"}//${options.hostname}${options.path}
reject(createHttpError(response, `method: ${options.method} url: ${options.protocol || "https:"}//${options.hostname}${options.path}

@@ -143,3 +148,3 @@ Please double check that your authentication token is correct. Due to security reasons actual status maybe not reported, but 404.

const isJson = contentType != null && (Array.isArray(contentType) ? contentType.find(it => it.includes("json")) != null : contentType.includes("json"));
reject(new HttpError(response, isJson ? JSON.parse(data) : data));
reject(createHttpError(response, isJson ? JSON.parse(data) : data));
} else {

@@ -146,0 +151,0 @@ resolve(data.length === 0 ? null : data);

export { CancellationToken, CancellationError } from "./CancellationToken";
export { HttpError, HttpExecutor, DownloadOptions, DigestTransform, RequestHeaders, safeGetHeader, configureRequestOptions, configureRequestOptionsFromUrl, safeStringifyJson, parseJson } from "./httpExecutor";
export { HttpError, createHttpError, HttpExecutor, DownloadOptions, DigestTransform, RequestHeaders, safeGetHeader, configureRequestOptions, configureRequestOptionsFromUrl, safeStringifyJson, parseJson } from "./httpExecutor";
export { BintrayOptions, GenericServerOptions, GithubOptions, PublishConfiguration, S3Options, SpacesOptions, BaseS3Options, getS3LikeProviderBaseUrl, Publish, githubUrl, PublishProvider, AllPublishOptions } from "./publishOptions";

@@ -4,0 +4,0 @@ export { UpdateInfo, UpdateFileInfo, WindowsUpdateInfo, BlockMapDataHolder, PackageFileInfo, ReleaseNoteInfo } from "./updateInfo";

@@ -38,2 +38,8 @@ "use strict";

});
Object.defineProperty(exports, "createHttpError", {
enumerable: true,
get: function () {
return (_httpExecutor || _load_httpExecutor()).createHttpError;
}
});
Object.defineProperty(exports, "HttpExecutor", {

@@ -40,0 +46,0 @@ enumerable: true,

{
"name": "builder-util-runtime",
"version": "3.2.0",
"version": "3.3.0",
"main": "out/index.js",

@@ -5,0 +5,0 @@ "author": "Vladimir Krivosheev",

Sorry, the diff of this file is not supported yet

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