Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@libj/http

Package Overview
Dependencies
Maintainers
2
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@libj/http - npm Package Compare versions

Comparing version 0.4.6 to 0.5.0

13

dist/client/types.d.ts

@@ -10,4 +10,15 @@ import { AxiosRequestConfig, AxiosResponse } from 'axios';

}
declare type LoggerSettingRequestDataLogMapper = (data: LooseObject) => LooseObject;
export type { LoggerSettingRequestDataLogMapper as HttpClientLoggerSettingRequestDataLogMapper };
interface LoggerSettingOptions {
requestDataLog?: boolean | LoggerSettingRequestDataLogMapper;
}
export { LoggerSettingOptions as HttpClientLoggerSettingOptions };
declare type LoggerSetting = LoggerInterface | {
logger: LoggerInterface;
options: LoggerSettingOptions;
};
export { LoggerSetting as HttpClientLoggerSetting };
export interface HttpClientConfig extends HttpRequestOptions {
logger?: LoggerInterface;
logger?: LoggerSetting;
}

@@ -14,0 +25,0 @@ export declare type HttpHeaders = LooseObject;

4

dist/interceptors/httpLoggerInterceptor.d.ts
import { AxiosInstance } from 'axios';
import { LoggerInterface } from '@libj/logger';
export declare function httpLoggerInterceptor(agent: AxiosInstance, logger: LoggerInterface): void;
import { HttpClientLoggerSetting } from '../client/types';
export declare function httpLoggerInterceptor(agent: AxiosInstance, loggerSetting: HttpClientLoggerSetting): void;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.httpLoggerInterceptor = void 0;
function httpLoggerInterceptor(agent, logger) {
var isType_1 = require("../common/isType/isType");
function httpLoggerInterceptor(agent, loggerSetting) {
var _a = parseLoggerSetting(loggerSetting), logger = _a.logger, loggerOptions = _a.options;
agent.interceptors.response.use(function (response) {
// @ts-ignore
var message = "[http] " + makeEndpoint(response.config) + " " + response.status + " " + response.statusText;

@@ -13,3 +16,3 @@ logger.info(message);

: error.toString();
var message = "[http] " + makeEndpoint(error.config) + " " + suffix;
var message = "[http] " + makeEndpoint(error.config, loggerOptions) + " " + suffix;
logger.error(message);

@@ -21,7 +24,16 @@ throw error;

/*** Lib ***/
function makeEndpoint(_a) {
var method = _a.method, baseURL = _a.baseURL, url = _a.url;
var uri = baseURL ? "" + baseURL + url : url;
return method.toUpperCase() + " " + uri;
function parseLoggerSetting(logger) {
return ('options' in logger) ? logger : { logger: logger, options: {} };
}
function makeEndpoint(_a, loggerOptions) {
var method = _a.method, baseURL = _a.baseURL, url = _a.url, data = _a.data;
var uri = baseURL ? "" + baseURL + url : url, parts = [method.toUpperCase(), uri];
if (loggerOptions === null || loggerOptions === void 0 ? void 0 : loggerOptions.requestDataLog) {
var finalData = isType_1.isBool(loggerOptions.requestDataLog)
? data
: loggerOptions.requestDataLog(data);
parts.push(JSON.stringify(finalData));
}
return parts.join(' ');
}
//# sourceMappingURL=httpLoggerInterceptor.js.map
{
"dependencies": {
"@libj/http-meta": "0.1.13",
"@libj/logger": "0.1.0",
"@libj/http-meta": "0.1.14",
"@libj/logger": "0.1.1",
"@libj/make-uri": "1.1.15",

@@ -11,3 +11,3 @@ "axios": "^0.21.1",

"name": "@libj/http",
"version": "0.4.6",
"version": "0.5.0",
"description": "Http toolbox",

@@ -36,3 +36,3 @@ "author": "Sergey Poskachey <seregynp@gmail.com>",

],
"gitHead": "30c84cffcfcb40909407cd18325d52c2daa9a6e7"
"gitHead": "ad1d7fef6e303f5b0f50eaa8c9bc2304a12c9058"
}

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