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

feat: add httpc.Do & httpc.Service.Do #1775

Merged
merged 10 commits into from
Apr 11, 2022
Merged

Conversation

kevwan
Copy link
Contributor

@kevwan kevwan commented Apr 9, 2022

The final method signatures are:

Do(ctx context, method, url string, data interface{}) (*http.Response, error)

type Service interface {
    Do(ctx context.Context, method, url string, data interface{}) (*http.Response, error)
    ...
}

The methods automatically convert data defined in API files into the *http.Request.

Validation is done automatically by the Do methods.

@kevwan kevwan marked this pull request as draft April 9, 2022 07:19
@kevwan kevwan requested a review from re-dylan April 9, 2022 08:40
@kevwan kevwan added this to the v1.3.3 milestone Apr 9, 2022
@kevwan kevwan added the feature Marks an issue or PR as related to a new feature. label Apr 9, 2022
@kevwan kevwan self-assigned this Apr 9, 2022
key: val,
}
}
collector[tag] = m
Copy link
Collaborator

@zhoushuguang zhoushuguang Apr 9, 2022

Choose a reason for hiding this comment

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

what's this line for?

Copy link
Contributor Author

@kevwan kevwan Apr 9, 2022

Choose a reason for hiding this comment

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

For example

	type Data struct {
		Key    string `path:"key"`
		Value  int    `form:"value"`
		Header string `header:"X-Header"`
		Body   string `json:"body"`
	}

I need to categorize the members by path, form, header, json, like the reverse operation of unmarshal.

core/mapping/marshaler.go Show resolved Hide resolved
@kevwan kevwan marked this pull request as ready for review April 9, 2022 14:57
@kevwan kevwan requested a review from zhoushuguang April 10, 2022 02:32
Copy link
Collaborator

@re-dylan re-dylan left a comment

Choose a reason for hiding this comment

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

LGTM

@kevwan kevwan merged commit 50de01f into zeromicro:master Apr 11, 2022
@kevwan kevwan deleted the feat/httpc branch April 11, 2022 03:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Marks an issue or PR as related to a new feature.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants