How to use the request-light.getErrorStatusDescription function in request-light

To help you get started, we’ve selected a few request-light examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / BotFramework-Composer / Composer / packages / tools / language-servers / language-understanding / src / LUServer.ts View on Github external
protected async resovleSchema(url: string): Promise {
    const uri = URI.parse(url);
    if (uri.scheme === 'file') {
      return new Promise((resolve, reject) => {
        // eslint-disable-next-line security/detect-non-literal-fs-filename
        fs.readFile(uri.fsPath, 'UTF-8', (err, result) => {
          err ? reject('') : resolve(result.toString());
        });
      });
    }
    try {
      const response = await xhr({ url, followRedirects: 5 });
      return response.responseText;
    } catch (error) {
      return Promise.reject(error.responseText || getErrorStatusDescription(error.status) || error.toString());
    }
  }
github microsoft / BotFramework-Composer / Composer / packages / tools / language-servers / lg-language-server / lib / server.js View on Github external
async resovleSchema(url) {
    const uri = vscode_uri_1.default.parse(url);
    if (uri.scheme === 'file') {
      return new Promise((resolve, reject) => {
        fs.readFile(uri.fsPath, 'UTF-8', (err, result) => {
          err ? reject('') : resolve(result.toString());
        });
      });
    }
    try {
      const response = await request_light_1.xhr({ url, followRedirects: 5 });
      return response.responseText;
    } catch (error) {
      return Promise.reject(
        error.responseText || request_light_1.getErrorStatusDescription(error.status) || error.toString()
      );
    }
  }
  // protected resolveCompletion(item: CompletionItem): Thenable {
github microsoft / BotFramework-Composer / Composer / packages / tools / language-servers / language-generation / src / LGServer.ts View on Github external
protected async resolveSchema(url: string): Promise {
    const uri = URI.parse(url);
    if (uri.scheme === 'file') {
      return new Promise((resolve, reject) => {
        // eslint-disable-next-line security/detect-non-literal-fs-filename
        readFile(uri.fsPath, 'UTF-8', (err, result) => {
          err ? reject('') : resolve(result.toString());
        });
      });
    }
    try {
      const response = await xhr({ url, followRedirects: 5 });
      return response.responseText;
    } catch (error) {
      return Promise.reject(error.responseText || getErrorStatusDescription(error.status) || error.toString());
    }
  }
github microsoft / BotFramework-Composer / Composer / packages / tools / language-servers / language-generation / src / server.ts View on Github external
protected async resovleSchema(url: string): Promise {
    const uri = URI.parse(url);
    if (uri.scheme === 'file') {
      return new Promise((resolve, reject) => {
        fs.readFile(uri.fsPath, 'UTF-8', (err, result) => {
          err ? reject('') : resolve(result.toString());
        });
      });
    }
    try {
      const response = await xhr({ url, followRedirects: 5 });
      return response.responseText;
    } catch (error) {
      return Promise.reject(error.responseText || getErrorStatusDescription(error.status) || error.toString());
    }
  }
github microsoft / BotFramework-Composer / Composer / packages / tools / language-servers / lg / server / src / lg-server.ts View on Github external
protected async resovleSchema(url: string): Promise {
    const uri = URI.parse(url);
    if (uri.scheme === 'file') {
      return new Promise((resolve, reject) => {
        fs.readFile(uri.fsPath, 'UTF-8', (err, result) => {
          err ? reject('') : resolve(result.toString());
        });
      });
    }
    try {
      const response = await xhr({ url, followRedirects: 5 });
      return response.responseText;
    } catch (error) {
      return Promise.reject(error.responseText || getErrorStatusDescription(error.status) || error.toString());
    }
  }
github threadheap / serverless-ide-vscode / packages / language-server / src / language-service / services / request / index.ts View on Github external
const response = await xhr(
			Object.assign(
				{
					url: uri,
					followRedirects: 5,
					headers: { "Accept-Encoding": "gzip, deflate" }
				},
				options
			)
		)
		return response.responseText
	} catch (error) {
		sendException(error)
		return (
			error.responseText ||
			getErrorStatusDescription(error.status) ||
			error.toString()
		)
	}
}
github redhat-developer / yaml-language-server / out / server / src / server.js View on Github external
}, (error) => {
        return Promise.reject(error.responseText || request_light_1.getErrorStatusDescription(error.status) || error.toString());
    });
};
github TypeFox / monaco-languageclient / example / src / json-server.ts View on Github external
protected async resolveSchema(url: string): Promise {
        const uri = URI.parse(url);
        if (uri.scheme === 'file') {
            return new Promise((resolve, reject) => {
                fs.readFile(uri.fsPath, 'UTF-8', (err, result) => {
                    err ? reject('') : resolve(result.toString());
                });
            });
        }
        try {
            const response = await xhr({ url, followRedirects: 5 });
            return response.responseText;
        }
        catch (error) {
            return Promise.reject(error.responseText || getErrorStatusDescription(error.status) || error.toString());
        }
    }
github redhat-developer / yaml-language-server / src / languageservice / services / schemaRequestHandler.ts View on Github external
                    (error: XHRResponse) => Promise.reject(error.responseText || getErrorStatusDescription(error.status) || error.toString()));
    }
github railsware / upterm / src / language-server / ShellLanguageServer.ts View on Github external
},                                         (error: XHRResponse) => {
            return Promise.reject(error.responseText || getErrorStatusDescription(error.status) || error.toString());
        });
    }

request-light

Lightweight request library. Promise based, with proxy support.

MIT
Latest version published 4 months ago

Package Health Score

75 / 100
Full package analysis