Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
xmrequest
Advanced tools
Readme
注意版本要求node 10.x及以上版本 由于依赖got中的cacheable-lookup, 需要node>=10.6.0, so
1.0.2
1.0.1
1.0.0
0.9.4
0.9.3
0.9.2
import {xmrequest} from 'xmrequest';
let r = xmrequest.post('http://test.com/version', {name: 'test'});
console.log(r);
0.9.1
0.9.0
0.0.2
import { Options, Response, RequestError, Headers } from 'got';
/** HTTP的方法 */
export declare enum EnumHttpMethod {
get = "GET",
post = "POST",
put = "PUT",
patch = "PATCH",
head = "HEAD",
delete = "DELETE",
options = "OPTIONS",
trace = "TRACE"
}
/** 成功失败的错误码 */
export declare enum EnumGotUtilsError {
OK = 0,
FAIL = -1
}
/** Got请求返回顺的数据 */
export interface IGotRequestReturn {
/** 抛出的异常 */
error?: RequestError;
/** Http请求的错误码,如200 */
statusCode?: number;
/** http请求返回的信息 */
statusMessage?: string;
/** 响应的http body */
body?: string;
/** 响应对象 */
response?: Response<string>;
}
/**
* xmrequest说明
* - 由于request已经停止更新,并且已经标记为deprecated了,为了未来的使用考虑,所以使用got代替request, 实现了这个类
* - 处理的结果与RequestUtils一样
*/
export declare class xmrequest {
/**
* 初始化选项
* - 这里会增加一个user-agent的header选项
* @param paramOptions 默认传入的选项
* @param paramMethod 要设置的方法 @see EnumHttpMethod
* @param paramheaders http的header选项
* @return 返回初始化的options
*/
private static initOptions;
/**
* 这个是通过 application/x-www-form-urlencoded 方式上传参数
* @param paramURL 请求的URL
* @param paramBody 要表求的消息
* @param paramOptions 请求选项
* @param paramHeaders 请求的headers信息
* @return 响应结果
*/
static post(paramURL: string, paramBody: any, paramOptions?: Options, paramheaders?: Headers): Promise<IGotRequestReturn>;
/**
* 这个是通过 application/x-www-form-urlencoded 方式上传参数
* @param paramURL 请求的URL
* @param paramBody 要表求的消息
* @param paramOptions 请求选项
* @param paramHeaders 请求的headers信息
* @returns 响应结果
*/
static jsonPost(paramURL: string, paramBody: any, paramOptions?: Options, paramheaders?: Headers): Promise<IGotRequestReturn>;
/**
* 这个是通过 get 方法调用请求
* @param paramURL 请求的URL
* @param {object} paramBody 要表求的消息
* @param {object} paramOptions 请求选项
* @param {object} paramHeaders 请求的headers信息
* @returns {{error ?: object, statusCode ?: number, statusMessage ?: string, body ?: string, response ?: any}} 响应结果
*/
static get(paramURL: string, paramBody: Record<string, string>, paramOptions?: {}, paramheaders?: {}): Promise<IGotRequestReturn>;
}
export default xmrequest;
FAQs
一个封装同步的request工具类
The npm package xmrequest receives a total of 1 weekly downloads. As such, xmrequest popularity was classified as not popular.
We found that xmrequest demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.