File tree Expand file tree Collapse file tree 2 files changed +10
-15
lines changed
Expand file tree Collapse file tree 2 files changed +10
-15
lines changed Original file line number Diff line number Diff line change 11package session
22
33import (
4+ "fmt"
5+
46 "github.com/kitecloud/kite/kite-service/internal/api/handler"
57)
68
79func (m * SessionManager ) RequireSession (next handler.HandlerFunc ) handler.HandlerFunc {
810 return func (c * handler.Context ) error {
911 session , err := m .Session (c )
1012 if err != nil {
11- return err
13+ return fmt . Errorf ( "failed to get session: %w" , err )
1214 }
1315
1416 if session == nil {
Original file line number Diff line number Diff line change @@ -427,7 +427,6 @@ func (s SnowflakeEnv) String() string {
427427
428428type HTTPResponseEnv struct {
429429 resp * http.Response
430- body []byte
431430
432431 Status string `expr:"status" json:"status"`
433432 StatusCode int `expr:"status_code" json:"status_code"`
@@ -440,19 +439,13 @@ func NewHTTPResponseEnv(resp *http.Response) *HTTPResponseEnv {
440439
441440 Status : resp .Status ,
442441 StatusCode : resp .StatusCode ,
443- }
444- res .BodyFunc = func () (string , error ) {
445- if res .body != nil {
446- return string (res .body ), nil
447- }
448-
449- body , err := io .ReadAll (resp .Body )
450- if err != nil {
451- return "" , err
452- }
453-
454- res .body = body
455- return string (body ), nil
442+ BodyFunc : func () (string , error ) {
443+ body , err := io .ReadAll (resp .Body )
444+ if err != nil {
445+ return "" , err
446+ }
447+ return string (body ), nil
448+ },
456449 }
457450
458451 return res
You can’t perform that action at this time.
0 commit comments