Socket
Socket
Sign inDemoInstall

wait-for-localhost

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wait-for-localhost - npm Package Compare versions

Comparing version 4.0.1 to 4.1.0

7

index.d.ts

@@ -22,2 +22,9 @@ export interface Options {

useGet?: boolean;
/**
HTTP status codes to consider as successful responses.
@default [200]
*/
statusCodes?: readonly number[];
}

@@ -24,0 +31,0 @@

4

index.js
import http from 'node:http';
export default function waitForLocalhost({port, path, useGet} = {}) {
export default function waitForLocalhost({port, path, useGet, statusCodes = [200]} = {}) {
return new Promise(resolve => {

@@ -13,3 +13,3 @@ const retry = () => {

const request = http.request({method, port, path, family: ipVersion}, response => {
if (response.statusCode === 200) {
if (statusCodes.includes(response.statusCode)) {
resolve({ipVersion});

@@ -16,0 +16,0 @@ return;

{
"name": "wait-for-localhost",
"version": "4.0.1",
"version": "4.1.0",
"description": "Wait for localhost to be ready",

@@ -15,2 +15,4 @@ "license": "MIT",

"exports": "./index.js",
"types": "./index.d.ts",
"sideEffects": false,
"engines": {

@@ -17,0 +19,0 @@ "node": "^12.20.0 || ^14.13.1 || >=16.0.0"

@@ -55,2 +55,9 @@ # wait-for-localhost

##### statusCodes
Type: `number[]`\
Default: `[200]`
HTTP status codes to consider as successful responses.
## Related

@@ -57,0 +64,0 @@

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