Skip to content

Commit

Permalink
Revert "调整链路追踪的字段"
Browse files Browse the repository at this point in the history
This reverts commit 96ce25a.
  • Loading branch information
steden committed Dec 26, 2023
1 parent 96ce25a commit 6e3e799
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion context/httpContext.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func NewHttpContext(httpRoute *HttpRoute, w http.ResponseWriter, r *http.Request
}
httpContext.Header = header.ToReadonlyDictionary()

// WebContentType
// ContentType
for _, contentType := range strings.Split(httpContext.Header.GetValue("Content-Type"), ";") {
if strings.Contains(contentType, "/") {
httpContext.ContentType = contentType
Expand Down
2 changes: 1 addition & 1 deletion context/httpJwt.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type HttpJwt struct {

// InitJwt jwt初始化
func InitJwt() {
jwtKey = []byte(configure.GetString("WebApi.Jwt.WatchKey"))
jwtKey = []byte(configure.GetString("WebApi.Jwt.Key"))
jwtKeyType = configure.GetString("WebApi.Jwt.KeyType")
headerName = configure.GetString("WebApi.Jwt.HeaderName")
InvalidStatusCode = configure.GetInt("WebApi.Jwt.InvalidStatusCode")
Expand Down
2 changes: 1 addition & 1 deletion middleware/cors.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ type Cors struct {
}

func (receiver *Cors) Invoke(httpContext *context.HttpContext) {
httpContext.Response.AddHeader("Access-Control-Allow-WebHeaders", httpContext.Header.GetValue("Access-Control-Request-WebHeaders"))
httpContext.Response.AddHeader("Access-Control-Allow-Headers", httpContext.Header.GetValue("Access-Control-Request-Headers"))
httpContext.Response.AddHeader("Access-Control-Allow-Methods", httpContext.Header.GetValue("Access-Control-Request-Methods"))
httpContext.Response.AddHeader("Access-Control-Allow-Credentials", "true")
httpContext.Response.AddHeader("Access-Control-Max-Age", "86400")
Expand Down
2 changes: 1 addition & 1 deletion middleware/routing.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func (receiver *routing) Invoke(httpContext *context.HttpContext) {
// 检查method
if httpContext.Method != "OPTIONS" && !httpContext.Route.Method.Contains(httpContext.Method) {
// 响应码
httpContext.Response.Reject(405, "405 WebMethod NotAllowed")
httpContext.Response.Reject(405, "405 Method NotAllowed")
return
}

Expand Down
2 changes: 1 addition & 1 deletion serveMux.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func (mux *serveMux) ServeHTTP(w http.ResponseWriter, r *http.Request) {
func (mux *serveMux) serveHTTPHandler(r *http.Request) (route *context.HttpRoute) {
// CONNECT requests are not canonicalized.
if r.Method == "CONNECT" {
// If r.URL.WebPath is /tree and its handler is not registered,
// If r.URL.Path is /tree and its handler is not registered,
// the /tree -> /tree/ redirect applies to CONNECT requests
// but the path canonicalization does not.
if u, ok := mux.redirectToPathSlash(r.URL.Host, r.URL.Path, r.URL); ok {
Expand Down
2 changes: 1 addition & 1 deletion test/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func (r *TestHeaderController) Hello3() (TValue string) {

func (r *TestHeaderController) OnActionExecuting() {
if r.HttpContext.Method != "GET" && r.Header.ContentType == "" {
panic("测试失败,未获取到:Header.WebContentType")
panic("测试失败,未获取到:Header.ContentType")
}
r.HttpContext.Response.AddHeader("Executing", "true")
r.HttpContext.Response.SetHeader("Set-Header1", "true")
Expand Down
2 changes: 1 addition & 1 deletion test/jwt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
func TestJwt(t *testing.T) {
// 测试生成出来的token与head是否一致
var buildToken string
configure.SetDefault("WebApi.Jwt.WatchKey", "123456888")
configure.SetDefault("WebApi.Jwt.Key", "123456888")
configure.SetDefault("WebApi.Jwt.KeyType", "HS256")
configure.SetDefault("WebApi.Jwt.HeaderName", "Auto_test")
configure.SetDefault("WebApi.Jwt.InvalidStatusCode", 403)
Expand Down

0 comments on commit 6e3e799

Please sign in to comment.