Skip to content

Commit

Permalink
fix is_http2_request
Browse files Browse the repository at this point in the history
  • Loading branch information
eguzki committed Nov 3, 2023
1 parent 060982a commit 9efa110
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 4 additions & 1 deletion dev-environments/grpc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ docker compose -p grpc logs -f one.upstream
## Testing


Get `grpcurl`

Get `grpcurl`. You need [Go SDK](https://golang.org/doc/install) installed.

Golang version >= 1.18 (from [fullstorydev/grpcurl](https://github.com/fullstorydev/grpcurl/blob/v1.8.9/go.mod#L3))

```sh
make grpcurl
Expand Down
4 changes: 1 addition & 3 deletions gateway/src/apicast/configuration/service.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ local http_methods_with_body = {
}

local function is_http2_request()
return ngx.req.http_version == '2.0'
return ngx.req.http_version() == 2.0
end

local function content_type_is_urlencoded(headers)
Expand All @@ -56,7 +56,6 @@ end
local function read_body_args(...)
local method = ngx.req.get_method()

ngx.log(ngx.WARN, "is_http2_request: ", is_http2_request())
if is_http2_request() then
return {}, 'not supported'
end
Expand Down Expand Up @@ -206,7 +205,6 @@ end
local function get_request_params(method)
local params = ngx.req.get_uri_args()

ngx.log(ngx.WARN, "is_http2_request: ", is_http2_request())
if is_http2_request() then
return params
end
Expand Down

0 comments on commit 9efa110

Please sign in to comment.