Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Fix empty body without content-length #202

Merged
merged 1 commit into from
Feb 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions examples/example-simple/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sisyphus.js/example-simple",
"version": "2.0.7",
"version": "2.0.8",
"description": "Example project using sisyphus.js",
"main": "dist/index.js",
"scripts": {
Expand All @@ -26,14 +26,14 @@
},
"homepage": "https://github.com/ButterCam/sisyphus-js#readme",
"devDependencies": {
"@sisyphus.js/cli": "^2.0.7",
"@sisyphus.js/google.proto": "^2.0.7",
"@sisyphus.js/runtime.proto": "^2.0.7"
"@sisyphus.js/cli": "^2.0.8",
"@sisyphus.js/google.proto": "^2.0.8",
"@sisyphus.js/runtime.proto": "^2.0.8"
},
"dependencies": {
"@sisyphus.js/google": "^2.0.7",
"@sisyphus.js/runtime": "^2.0.7",
"@sisyphus.js/transport-aip": "^2.0.7"
"@sisyphus.js/google": "^2.0.8",
"@sisyphus.js/runtime": "^2.0.8",
"@sisyphus.js/transport-aip": "^2.0.8"
},
"directories": {
"proto": "proto"
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"packages/*",
"examples/*"
],
"version": "2.0.7"
"version": "2.0.8"
}
10 changes: 5 additions & 5 deletions packages/sisyphus-cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sisyphus.js/cli",
"version": "2.0.7",
"version": "2.0.8",
"description": "Protoc cli for sisyphus project on js platform",
"bin": {
"sisygen": "lib/index.js"
Expand Down Expand Up @@ -30,10 +30,10 @@
},
"homepage": "https://github.com/ButterCam/sisyphus-js#readme",
"dependencies": {
"@sisyphus.js/compiler": "^2.0.7",
"@sisyphus.js/protoc": "^2.0.7",
"@sisyphus.js/runtime": "^2.0.7",
"@sisyphus.js/runtime.proto": "^2.0.7",
"@sisyphus.js/compiler": "^2.0.8",
"@sisyphus.js/protoc": "^2.0.8",
"@sisyphus.js/runtime": "^2.0.8",
"@sisyphus.js/runtime.proto": "^2.0.8",
"commander": "^10.0.0",
"npmlog": "^7.0.1"
}
Expand Down
4 changes: 2 additions & 2 deletions packages/sisyphus-compiler/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sisyphus.js/compiler",
"version": "2.0.7",
"version": "2.0.8",
"description": "Precompiled google common protos by sisyphus protobuf compiler",
"main": "lib/index.js",
"sisyphus": {
Expand Down Expand Up @@ -35,6 +35,6 @@
},
"homepage": "https://github.com/ButterCam/sisyphus-js#readme",
"dependencies": {
"@sisyphus.js/protoc": "^2.0.7"
"@sisyphus.js/protoc": "^2.0.8"
}
}
10 changes: 5 additions & 5 deletions packages/sisyphus-google-aip/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sisyphus.js/google.aip",
"version": "2.0.7",
"version": "2.0.8",
"description": "Precompiled google common aip clients by sisyphus protobuf compiler",
"scripts": {
"clean": "tsc --build --clean",
Expand Down Expand Up @@ -33,12 +33,12 @@
},
"homepage": "https://github.com/ButterCam/sisyphus-js#readme",
"devDependencies": {
"@sisyphus.js/cli": "^2.0.7",
"@sisyphus.js/google.proto": "^2.0.7"
"@sisyphus.js/cli": "^2.0.8",
"@sisyphus.js/google.proto": "^2.0.8"
},
"dependencies": {
"@sisyphus.js/google": "^2.0.7",
"@sisyphus.js/transport-aip": "^2.0.7"
"@sisyphus.js/google": "^2.0.8",
"@sisyphus.js/transport-aip": "^2.0.8"
},
"directories": {
"lib": "lib"
Expand Down
10 changes: 5 additions & 5 deletions packages/sisyphus-google-proto/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sisyphus.js/google.proto",
"version": "2.0.7",
"version": "2.0.8",
"description": "Precompiled google common protos with full protobuf by sisyphus protobuf compiler",
"main": "lib/index.js",
"scripts": {
Expand Down Expand Up @@ -34,12 +34,12 @@
},
"homepage": "https://github.com/ButterCam/sisyphus-js#readme",
"devDependencies": {
"@sisyphus.js/cli": "^2.0.7"
"@sisyphus.js/cli": "^2.0.8"
},
"dependencies": {
"@sisyphus.js/google": "^2.0.7",
"@sisyphus.js/runtime": "^2.0.7",
"@sisyphus.js/runtime.proto": "^2.0.7"
"@sisyphus.js/google": "^2.0.8",
"@sisyphus.js/runtime": "^2.0.8",
"@sisyphus.js/runtime.proto": "^2.0.8"
},
"directories": {
"lib": "lib"
Expand Down
6 changes: 3 additions & 3 deletions packages/sisyphus-google/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sisyphus.js/google",
"version": "2.0.7",
"version": "2.0.8",
"description": "Precompiled google common protos by sisyphus protobuf compiler",
"scripts": {
"clean": "tsc --build --clean",
Expand Down Expand Up @@ -34,10 +34,10 @@
},
"homepage": "https://github.com/ButterCam/sisyphus-js#readme",
"devDependencies": {
"@sisyphus.js/cli": "^2.0.7"
"@sisyphus.js/cli": "^2.0.8"
},
"dependencies": {
"@sisyphus.js/runtime": "^2.0.7"
"@sisyphus.js/runtime": "^2.0.8"
},
"directories": {
"lib": "lib",
Expand Down
2 changes: 1 addition & 1 deletion packages/sisyphus-protoc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sisyphus.js/protoc",
"version": "2.0.7",
"version": "2.0.8",
"description": "Install protoc for current platform.",
"main": "lib/index.js",
"bin": {
Expand Down
4 changes: 2 additions & 2 deletions packages/sisyphus-runtime-proto/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sisyphus.js/runtime.proto",
"version": "2.0.7",
"version": "2.0.8",
"description": "Protobuf full runtime for sisyphus project on js platform, support protobuf binary format.",
"main": "lib/index.js",
"scripts": {
Expand Down Expand Up @@ -34,7 +34,7 @@
},
"homepage": "https://github.com/ButterCam/sisyphus-js#readme",
"dependencies": {
"@sisyphus.js/runtime": "^2.0.7"
"@sisyphus.js/runtime": "^2.0.8"
},
"directories": {
"lib": "lib"
Expand Down
2 changes: 1 addition & 1 deletion packages/sisyphus-runtime/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sisyphus.js/runtime",
"version": "2.0.7",
"version": "2.0.8",
"description": "Protobuf lite runtime for sisyphus project on js platform, only support JSON format.",
"main": "lib/index.js",
"scripts": {
Expand Down
6 changes: 3 additions & 3 deletions packages/sisyphus-transport-aip/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sisyphus.js/transport-aip",
"version": "2.0.7",
"version": "2.0.8",
"description": "gRPC transport based on AIP spec(gRPC to HTTP/Json Transcoding).",
"main": "lib/index.js",
"scripts": {
Expand Down Expand Up @@ -32,8 +32,8 @@
},
"homepage": "https://github.com/ButterCam/sisyphus-js#readme",
"dependencies": {
"@sisyphus.js/google": "^2.0.7",
"@sisyphus.js/runtime": "^2.0.7"
"@sisyphus.js/google": "^2.0.8",
"@sisyphus.js/runtime": "^2.0.8"
},
"directories": {
"lib": "lib",
Expand Down
7 changes: 5 additions & 2 deletions packages/sisyphus-transport-aip/src/rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,13 @@ export function transcoding(host: string, config?: TranscodingListener): Rpc {
if (response.status === 204) {
return {}
}
if (parseInt(response.headers.get('content-length') || '0') === 0) {
if (response.headers.get('content-length') === '0') {
return {}
}
return await response.json()
if (response.headers.get('content-type')?.startsWith('application/json')) {
return await response.json()
}
return {}
} else {
const status = await response.json()
throw new StatusError(status, method, request, response)
Expand Down