Compare commits

...

3 Commits

Author SHA1 Message Date
Flc゛
990c44aebf
docs(context): Added deprecation comments to BindWith (#3880) 2024-03-12 13:55:52 +08:00
Endless Paradox
861ffb9181
docs(middleware): comments to function BasicAuthForProxy (#3881) 2024-03-12 13:51:04 +08:00
Flc゛
f70dd00b00
fix(engine): fix unit test (#3878)
* fix(engine): fix unit test

* fix(engine): fix unit test
2024-03-12 13:49:23 +08:00
3 changed files with 4 additions and 1 deletions

View File

@ -91,6 +91,7 @@ func authorizationHeader(user, password string) string {
return "Basic " + base64.StdEncoding.EncodeToString(bytesconv.StringToBytes(base))
}
// BasicAuthForProxy returns a Basic HTTP Proxy-Authorization middleware.
func BasicAuthForProxy(accounts Accounts, realm string) HandlerFunc {
if realm == "" {
realm = "Proxy Authorization Required"

View File

@ -1044,7 +1044,7 @@ func TestContextRenderAndEscapeAttachment(t *testing.T) {
c.FileAttachment("./gin.go", maliciousFilename)
assert.Equal(t, 200, w.Code)
assert.Contains(t, w.Body.String(), "func New() *Engine {")
assert.Contains(t, w.Body.String(), "func New(opts ...OptionFunc) *Engine {")
assert.Equal(t, fmt.Sprintf("attachment; filename=\"%s\"", actualEscapedResponseFilename), w.Header().Get("Content-Disposition"))
}

View File

@ -12,6 +12,8 @@ import (
// BindWith binds the passed struct pointer using the specified binding engine.
// See the binding package.
//
// Deprecated: Use MustBindWith or ShouldBindWith.
func (c *Context) BindWith(obj any, b binding.Binding) error {
log.Println(`BindWith(\"any, binding.Binding\") error is going to
be deprecated, please check issue #662 and either use MustBindWith() if you