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

add ServeHTTP to Server/Engin for doing Httptest #2704

Merged
merged 1 commit into from
Jan 1, 2023

Conversation

RyanTokManMokMTM
Copy link
Contributor

@RyanTokManMokMTM RyanTokManMokMTM commented Dec 14, 2022

Is similar to gin-gonic , allow developer to do a unit test with all defined router without starting a HTTP Server.
For example:
server := MustNewServer(...)
server.addRoute(...) // router a
server.addRoute(...) // router b
server.addRoute(...) // router c

req, _ := http.NewRequest(...)
w := httptest.NewRecorder(...)
server.ServeHTTP(w,req)

//TODO : test after response

Copy link
Contributor

@kevwan kevwan 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 3e9d016 into zeromicro:master Jan 1, 2023
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.

2 participants