github.com/hellobchain/third_party@v0.0.0-20230331131523-deb0478a2e52/gorilla/mux/context.go (about)

     1  package mux
     2  
     3  import (
     4  	"context"
     5  	"github.com/hellobchain/newcryptosm/http"
     6  )
     7  
     8  func contextGet(r *http.Request, key interface{}) interface{} {
     9  	return r.Context().Value(key)
    10  }
    11  
    12  func contextSet(r *http.Request, key, val interface{}) *http.Request {
    13  	if val == nil {
    14  		return r
    15  	}
    16  
    17  	return r.WithContext(context.WithValue(r.Context(), key, val))
    18  }