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

Feature/http 2 http param mapping #57

Merged

Conversation

williamfeng323
Copy link
Contributor

What this PR does:

  • adding parameters mapping for http-2-http gateway
  • adding retrieving URI parameters from request and map to dubbo parameters.
  • bug fix of using request.GetBody on server side

Which issue(s) this PR fixes:

Fixes #54 #56

Special notes for your reviewer:

Does this PR introduce a user-facing change?:


@codecov-io
Copy link

codecov-io commented Nov 15, 2020

Codecov Report

Merging #57 (7952ad8) into develop (7eeed7e) will decrease coverage by 2.03%.
The diff coverage is 68.04%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop      #57      +/-   ##
===========================================
- Coverage    45.74%   43.71%   -2.04%     
===========================================
  Files           21       28       +7     
  Lines          929     1217     +288     
===========================================
+ Hits           425      532     +107     
- Misses         454      613     +159     
- Partials        50       72      +22     
Impacted Files Coverage Δ
pkg/client/dubbo/dubbo.go 18.47% <16.66%> (-9.56%) ⬇️
pkg/client/http/mapper.go 64.94% <64.94%> (ø)
pkg/client/http/http.go 35.71% <69.23%> (ø)
pkg/client/dubbo/mapper.go 65.38% <71.79%> (+5.73%) ⬆️
pkg/router/route.go 96.87% <81.81%> (+1.35%) ⬆️
pkg/client/mapper.go 88.23% <84.61%> (ø)
pkg/router/api.go 100.00% <100.00%> (ø)
pkg/client/response.go 0.00% <0.00%> (ø)
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7eeed7e...7952ad8. Read the comment docs.

@williamfeng323 williamfeng323 force-pushed the feature/http-2-http-param-mapping branch from 15dc11f to 327372f Compare November 15, 2020 14:54
@williamfeng323 williamfeng323 force-pushed the feature/http-2-http-param-mapping branch from 327372f to a678ce7 Compare November 17, 2020 07:50
@@ -30,19 +30,30 @@ import (
)

import (
"encoding/json"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

position not ok

return nil, nil
type uriMapper struct{}

func (um uriMapper) Map(mp config.MappingParam, c client.Request, target interface{}) error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Map is public, add // nolint?


type bodyMapper struct{}

func (bm bodyMapper) Map(mp config.MappingParam, c client.Request, rawTarget interface{}) error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// nolint

import (
"github.com/dubbogo/dubbo-go-proxy/pkg/config"
"strings"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move to first import part

package router

import (
"github.com/dubbogo/dubbo-go-proxy/pkg/config"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

split import

@@ -30,6 +30,7 @@ import (
import (
"github.com/dubbogo/dubbo-go-proxy/pkg/common/constant"
"github.com/dubbogo/dubbo-go-proxy/pkg/config"
"net/url"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

split import

r.Header = req.IngressRequest.Header.Clone()
queryValues, err := url.ParseQuery(req.IngressRequest.URL.RawQuery)
if err != nil {
return nil, errors.New("Retrieve request query parameters failed")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need create err together errors.New() in next step.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree.

@williamfeng323 williamfeng323 force-pushed the feature/http-2-http-param-mapping branch from d4d4984 to aa8f29d Compare November 17, 2020 14:03
@@ -162,22 +154,22 @@ func (dc *Client) Call(req *client.Request) (res interface{}, err error) {
return rst, nil
}

// MappingParams param mapping to api.
func (dc *Client) MappingParams(req *client.Request) ([]string, []interface{}, error) {
// MapParams param mapping to api.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

“s” is lost

type queryStringsMapper struct{}

// nolint
func (qm queryStringsMapper) Map(mp config.MappingParam, c client.Request, target interface{}) error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why isn't the caller pointer?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

originally, I don't hope to modify anything inside the client.Request, but since I have to add back the body after mapping the request body, I think pointer might be better now.

@zhangshen023 zhangshen023 merged commit 1775274 into apache:develop Nov 19, 2020
@cityiron cityiron added this to the v0.1.0 milestone Dec 19, 2020
mark4z pushed a commit that referenced this pull request Nov 7, 2021
…mapping

Feature/http 2 http param mapping

Former-commit-id: e270958 [formerly 1775274]
Former-commit-id: e270958
Former-commit-id: b60d0e2
tydhot pushed a commit to tydhot/dubbo-go-pixiu that referenced this pull request Nov 10, 2021
…param-mapping

Feature/http 2 http param mapping

Former-commit-id: b69bc20 [formerly e270958 [formerly 1775274]]
Former-commit-id: d5a4696 [formerly e270958]
Former-commit-id: 0d02731 [formerly b60d0e2]
Former-commit-id: c681bea
bobtthp pushed a commit to bobtthp/dubbo-go-pixiu that referenced this pull request Dec 12, 2022
…param-mapping

Feature/http 2 http param mapping

Former-commit-id: 1775274
Former-commit-id: e270958
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Param mapping for HTTP-2-HTTP request
5 participants