Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@bufbuild/connect

Package Overview
Dependencies
Maintainers
11
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bufbuild/connect - npm Package Compare versions

Comparing version 0.10.1 to 0.11.0

6

dist/cjs/protocol-connect/validate-response.js

@@ -21,2 +21,3 @@ "use strict";

const connect_error_js_1 = require("../connect-error.js");
const content_type_js_1 = require("./content-type.js");
const headers_js_1 = require("./headers.js");

@@ -34,5 +35,8 @@ /**

function validateResponse(methodKind, status, headers) {
const mimeType = headers.get("Content-Type");
const parsedType = (0, content_type_js_1.parseContentType)(mimeType);
if (status !== 200) {
const errorFromStatus = new connect_error_js_1.ConnectError(`HTTP ${status}`, (0, http_status_js_1.codeFromHttpStatus)(status), headers);
if (methodKind == protobuf_1.MethodKind.Unary) {
// If parsedType is defined and it is not binary, then this is a unary JSON response
if (methodKind == protobuf_1.MethodKind.Unary && parsedType && !parsedType.binary) {
return { isUnaryError: true, unaryError: errorFromStatus };

@@ -39,0 +43,0 @@ }

@@ -18,2 +18,3 @@ // Copyright 2021-2023 Buf Technologies, Inc.

import { ConnectError } from "../connect-error.js";
import { parseContentType } from "./content-type.js";
import { headerStreamEncoding, headerUnaryEncoding } from "./headers.js";

@@ -31,5 +32,8 @@ /**

export function validateResponse(methodKind, status, headers) {
const mimeType = headers.get("Content-Type");
const parsedType = parseContentType(mimeType);
if (status !== 200) {
const errorFromStatus = new ConnectError(`HTTP ${status}`, codeFromHttpStatus(status), headers);
if (methodKind == MethodKind.Unary) {
// If parsedType is defined and it is not binary, then this is a unary JSON response
if (methodKind == MethodKind.Unary && parsedType && !parsedType.binary) {
return { isUnaryError: true, unaryError: errorFromStatus };

@@ -36,0 +40,0 @@ }

2

package.json
{
"name": "@bufbuild/connect",
"version": "0.10.1",
"version": "0.11.0",
"description": "Type-safe APIs with Protobuf and TypeScript.",

@@ -5,0 +5,0 @@ "license": "Apache-2.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