func (RequireAsyncMiddleware) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc) {
	if r.URL.Query().Get("accepts_incomplete") != "true" {
		writeErrorResponse(rw, http.StatusUnprocessableEntity, "AsyncRequired", "This service plan requires client support for asynchronous service operations.")
		return
	}
	next(rw, r)
}
ServeHTTP handling asynchronous HTTP requests in Open Service Broker Api
package broker
import (
	"net/http"
	"github.com/gorilla/mux"
	osb "github.com/kubernetes-sigs/go-open-service-broker-client/v2"
	"github.com/kyma-project/helm-broker/internal"
)
type OSBContextMiddleware struct{}
func (OSBContextMiddleware) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc) {
	brokerNamespace := mux.Vars(r)["namespace"]
	if brokerNamespace == "" {
		brokerNamespace = string(internal.ClusterWide)
	}
	osbCtx := OsbContext{
		APIVersion:          r.Header.Get(osb.APIVersionHeader),
		OriginatingIdentity: r.Header.Get(osb.OriginatingIdentityHeader),
		BrokerNamespace:     internal.Namespace(brokerNamespace),
	}
	if err := osbCtx.validateAPIVersion(); err != nil {
		writeErrorResponse(rw, http.StatusPreconditionFailed, err.Error(), "Requests requires the 'X-Broker-API-Version' header specified")
		return
	}
	if err := osbCtx.validateOriginatingIdentity(); err != nil {
		writeErrorResponse(rw, http.StatusPreconditionFailed, err.Error(), "Requests requires the 'X-Broker-API-Originating-Identity' header specified")
		return
	}
	r = r.WithContext(contextWithOSB(r.Context(), osbCtx))
	next(rw, r)
}
type RequireAsyncMiddleware struct{}