github.com/cookieai-jar/moby@v17.12.1-ce-rc2+incompatible/api/server/router/session/session_routes.go (about)

     1  package session
     2  
     3  import (
     4  	"net/http"
     5  
     6  	"golang.org/x/net/context"
     7  )
     8  
     9  type invalidRequest struct {
    10  	cause error
    11  }
    12  
    13  func (e invalidRequest) Error() string {
    14  	return e.cause.Error()
    15  }
    16  
    17  func (e invalidRequest) Cause() error {
    18  	return e.cause
    19  }
    20  
    21  func (e invalidRequest) InvalidParameter() {}
    22  
    23  func (sr *sessionRouter) startSession(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
    24  	err := sr.backend.HandleHTTPRequest(ctx, w, r)
    25  	if err != nil {
    26  		return invalidRequest{err}
    27  	}
    28  	return nil
    29  }