
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
A simple http request client module based on Node.js https module
multipart/form-data and application/json content typenpm i node-https
typescript example
import { Http, HttpRequestOptions, Method } from '@node-https';
// ...
const http = new Http();
app.get('/', async (req: Request, res: Response) => {
const options: HttpRequestOptions = {
headers: {
token: '1-2-3-4',
},
params: {
key: 'hello',
},
};
try {
const result = await http.get(url, options);
res.status(result.status).json(result.data ?? { body: result.body });
} catch (e) {
res.status(e.status || 500).json(e.data);
}
});
form type request, the field value which is base64 encoded
image will convert to file item automaticlly, for example// form format data:
[
{
field: 'id',
value: 'avatar',
},
{
field: 'image',
value: 'data:image/png;base64,xxxxxxxxxxxxx',
},
];
// will convert to
[
{
field: 'id',
value: 'avatar',
},
{
field: 'image',
file: FileData,
},
];
Http.post(
'url',
{
id: 'avatar',
image: 'data:image/png;base64,xxxxxxxxxxxxx',
},
{ form: true }
);
type Method = 'POST' | 'GET' | 'PUT' | 'DELETE';
type Params = { [key: string]: any };
type JsonDataType = { [key: string]: any } | [];
type FormDataType = {
field: string;
value?: string;
file?: {
buffer: Buffer;
filename: string;
};
}[];
interface HttpResponse {
status: number;
// when http response body is JSON string format
data?: { [key: string]: any };
// when http response body is **NOT** JSON string format
body?: string;
}
interface HttpRequestOptions {
hostname?: string;
port?: number;
path?: string;
method?: Method;
form?: boolean;
headers?: { [key: string]: any };
params?: Params;
data?: JsonDataType | FormDataType;
}
interface HttpOptions {
headers?: { [key: string]: string };
params?: Params;
}
interface HttpPostOptions extends HttpOptions {
form?: boolean;
}
get(url: string, options?: HttpOptions): Promise<HttpResponse>
put(
url: string,
data?: JsonDataType,
options?: HttpOptions
): Promise<HttpResponse>
post(
url: string,
data?: JsonDataType | FormDataType,
options?: HttpPostOptions
): Promise<HttpResponse>
delete(url: string, options?: HttpOptions): Promise<HttpResponse>
put or post
porp(
method: 'PUT' | 'POST',
url: string,
data?: JsonDataType,
options?: HttpOptions
): Promise<HttpResponse>
request(
url: string,
method: Method,
options?: HttpRequestOptions
): Promise<HttpResponse>
FAQs
A simple http request module based on Node.js https module
The npm package node-https receives a total of 179 weekly downloads. As such, node-https popularity was classified as not popular.
We found that node-https 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
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.