mirror of
https://github.com/dawidd6/action-send-mail.git
synced 2025-12-27 08:00:17 +07:00
node_modules: update (#246)
Co-authored-by: dawidd6 <9713907+dawidd6@users.noreply.github.com>
This commit is contained in:
120
node_modules/@actions/http-client/lib/index.js
generated
vendored
120
node_modules/@actions/http-client/lib/index.js
generated
vendored
@@ -16,13 +16,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || (function () {
|
||||
var ownKeys = function(o) {
|
||||
ownKeys = Object.getOwnPropertyNames || function (o) {
|
||||
var ar = [];
|
||||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
||||
return ar;
|
||||
};
|
||||
return ownKeys(o);
|
||||
};
|
||||
return function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
})();
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
@@ -33,7 +43,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.HttpClient = exports.isHttps = exports.HttpClientResponse = exports.HttpClientError = exports.getProxyUrl = exports.MediaTypes = exports.Headers = exports.HttpCodes = void 0;
|
||||
exports.HttpClient = exports.HttpClientResponse = exports.HttpClientError = exports.MediaTypes = exports.Headers = exports.HttpCodes = void 0;
|
||||
exports.getProxyUrl = getProxyUrl;
|
||||
exports.isHttps = isHttps;
|
||||
const http = __importStar(require("http"));
|
||||
const https = __importStar(require("https"));
|
||||
const pm = __importStar(require("./proxy"));
|
||||
@@ -86,7 +98,6 @@ function getProxyUrl(serverUrl) {
|
||||
const proxyUrl = pm.getProxyUrl(new URL(serverUrl));
|
||||
return proxyUrl ? proxyUrl.href : '';
|
||||
}
|
||||
exports.getProxyUrl = getProxyUrl;
|
||||
const HttpRedirectCodes = [
|
||||
HttpCodes.MovedPermanently,
|
||||
HttpCodes.ResourceMoved,
|
||||
@@ -147,7 +158,6 @@ function isHttps(requestUrl) {
|
||||
const parsedUrl = new URL(requestUrl);
|
||||
return parsedUrl.protocol === 'https:';
|
||||
}
|
||||
exports.isHttps = isHttps;
|
||||
class HttpClient {
|
||||
constructor(userAgent, handlers, requestOptions) {
|
||||
this._ignoreSslError = false;
|
||||
@@ -230,36 +240,39 @@ class HttpClient {
|
||||
* Gets a typed object from an endpoint
|
||||
* Be aware that not found returns a null. Other errors (4xx, 5xx) reject the promise
|
||||
*/
|
||||
getJson(requestUrl, additionalHeaders = {}) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
getJson(requestUrl_1) {
|
||||
return __awaiter(this, arguments, void 0, function* (requestUrl, additionalHeaders = {}) {
|
||||
additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
|
||||
const res = yield this.get(requestUrl, additionalHeaders);
|
||||
return this._processResponse(res, this.requestOptions);
|
||||
});
|
||||
}
|
||||
postJson(requestUrl, obj, additionalHeaders = {}) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
postJson(requestUrl_1, obj_1) {
|
||||
return __awaiter(this, arguments, void 0, function* (requestUrl, obj, additionalHeaders = {}) {
|
||||
const data = JSON.stringify(obj, null, 2);
|
||||
additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
|
||||
additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson);
|
||||
additionalHeaders[Headers.ContentType] =
|
||||
this._getExistingOrDefaultContentTypeHeader(additionalHeaders, MediaTypes.ApplicationJson);
|
||||
const res = yield this.post(requestUrl, data, additionalHeaders);
|
||||
return this._processResponse(res, this.requestOptions);
|
||||
});
|
||||
}
|
||||
putJson(requestUrl, obj, additionalHeaders = {}) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
putJson(requestUrl_1, obj_1) {
|
||||
return __awaiter(this, arguments, void 0, function* (requestUrl, obj, additionalHeaders = {}) {
|
||||
const data = JSON.stringify(obj, null, 2);
|
||||
additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
|
||||
additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson);
|
||||
additionalHeaders[Headers.ContentType] =
|
||||
this._getExistingOrDefaultContentTypeHeader(additionalHeaders, MediaTypes.ApplicationJson);
|
||||
const res = yield this.put(requestUrl, data, additionalHeaders);
|
||||
return this._processResponse(res, this.requestOptions);
|
||||
});
|
||||
}
|
||||
patchJson(requestUrl, obj, additionalHeaders = {}) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
patchJson(requestUrl_1, obj_1) {
|
||||
return __awaiter(this, arguments, void 0, function* (requestUrl, obj, additionalHeaders = {}) {
|
||||
const data = JSON.stringify(obj, null, 2);
|
||||
additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
|
||||
additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson);
|
||||
additionalHeaders[Headers.ContentType] =
|
||||
this._getExistingOrDefaultContentTypeHeader(additionalHeaders, MediaTypes.ApplicationJson);
|
||||
const res = yield this.patch(requestUrl, data, additionalHeaders);
|
||||
return this._processResponse(res, this.requestOptions);
|
||||
});
|
||||
@@ -488,12 +501,73 @@ class HttpClient {
|
||||
}
|
||||
return lowercaseKeys(headers || {});
|
||||
}
|
||||
/**
|
||||
* Gets an existing header value or returns a default.
|
||||
* Handles converting number header values to strings since HTTP headers must be strings.
|
||||
* Note: This returns string | string[] since some headers can have multiple values.
|
||||
* For headers that must always be a single string (like Content-Type), use the
|
||||
* specialized _getExistingOrDefaultContentTypeHeader method instead.
|
||||
*/
|
||||
_getExistingOrDefaultHeader(additionalHeaders, header, _default) {
|
||||
let clientHeader;
|
||||
if (this.requestOptions && this.requestOptions.headers) {
|
||||
clientHeader = lowercaseKeys(this.requestOptions.headers)[header];
|
||||
const headerValue = lowercaseKeys(this.requestOptions.headers)[header];
|
||||
if (headerValue) {
|
||||
clientHeader =
|
||||
typeof headerValue === 'number' ? headerValue.toString() : headerValue;
|
||||
}
|
||||
}
|
||||
return additionalHeaders[header] || clientHeader || _default;
|
||||
const additionalValue = additionalHeaders[header];
|
||||
if (additionalValue !== undefined) {
|
||||
return typeof additionalValue === 'number'
|
||||
? additionalValue.toString()
|
||||
: additionalValue;
|
||||
}
|
||||
if (clientHeader !== undefined) {
|
||||
return clientHeader;
|
||||
}
|
||||
return _default;
|
||||
}
|
||||
/**
|
||||
* Specialized version of _getExistingOrDefaultHeader for Content-Type header.
|
||||
* Always returns a single string (not an array) since Content-Type should be a single value.
|
||||
* Converts arrays to comma-separated strings and numbers to strings to ensure type safety.
|
||||
* This was split from _getExistingOrDefaultHeader to provide stricter typing for callers
|
||||
* that assign the result to places expecting a string (e.g., additionalHeaders[Headers.ContentType]).
|
||||
*/
|
||||
_getExistingOrDefaultContentTypeHeader(additionalHeaders, _default) {
|
||||
let clientHeader;
|
||||
if (this.requestOptions && this.requestOptions.headers) {
|
||||
const headerValue = lowercaseKeys(this.requestOptions.headers)[Headers.ContentType];
|
||||
if (headerValue) {
|
||||
if (typeof headerValue === 'number') {
|
||||
clientHeader = String(headerValue);
|
||||
}
|
||||
else if (Array.isArray(headerValue)) {
|
||||
clientHeader = headerValue.join(', ');
|
||||
}
|
||||
else {
|
||||
clientHeader = headerValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
const additionalValue = additionalHeaders[Headers.ContentType];
|
||||
// Return the first non-undefined value, converting numbers or arrays to strings if necessary
|
||||
if (additionalValue !== undefined) {
|
||||
if (typeof additionalValue === 'number') {
|
||||
return String(additionalValue);
|
||||
}
|
||||
else if (Array.isArray(additionalValue)) {
|
||||
return additionalValue.join(', ');
|
||||
}
|
||||
else {
|
||||
return additionalValue;
|
||||
}
|
||||
}
|
||||
if (clientHeader !== undefined) {
|
||||
return clientHeader;
|
||||
}
|
||||
return _default;
|
||||
}
|
||||
_getAgent(parsedUrl) {
|
||||
let agent;
|
||||
|
||||
Reference in New Issue
Block a user