Socket
Socket
Sign inDemoInstall

grpc-server-js

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grpc-server-js - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

23

lib/server.js

@@ -19,3 +19,9 @@ 'use strict';

const kBidiHandlerType = 3;
const { HTTP2_HEADER_PATH } = Http2.constants;
const kValidContentTypePrefix = 'application/grpc';
const {
HTTP2_HEADER_CONTENT_TYPE,
HTTP2_HEADER_STATUS,
HTTP2_HEADER_PATH,
HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE
} = Http2.constants;

@@ -28,3 +34,8 @@

const unsuportedMediaTypeResponse = {
[HTTP2_HEADER_STATUS]: HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE
};
const unsuportedMediaTypeResponseOptions = { endStream: true };
const defaultHandler = [

@@ -237,2 +248,3 @@ function unary (call, callback) {

if (grpcServer[kStarted] !== true) {
stream.respond();
stream.end();

@@ -242,2 +254,11 @@ return;

const contentType = headers[HTTP2_HEADER_CONTENT_TYPE];
if (typeof contentType !== 'string' ||
!contentType.startsWith(kValidContentTypePrefix)) {
stream.respond(unsuportedMediaTypeResponse,
unsuportedMediaTypeResponseOptions);
return;
}
const call = new ServerCall(stream);

@@ -244,0 +265,0 @@

6

package.json
{
"name": "grpc-server-js",
"version": "0.1.2",
"version": "0.1.3",
"description": "Pure JavaScript gRPC Server",

@@ -29,6 +29,6 @@ "author": "Colin J. Ihrig <cjihrig@gmail.com> (http://www.cjihrig.com/)",

"devDependencies": {
"@grpc/proto-loader": "0.5.0",
"@grpc/proto-loader": "0.5.x",
"belly-button": "5.x.x",
"cb-barrier": "1.x.x",
"@hapi/lab": "18.x.x"
"@hapi/lab": "19.x.x"
},

@@ -35,0 +35,0 @@ "keywords": [

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