I am pretty new to golang and trying to set my response headers. I have two headers that I want to set. I think that I am misunderstanding something fundamental. I am also using go-swagger to generate my endpoints.
My problem is that I can only seem to set one of my two headers. Swagger provides a function "auth.NewAuthLoginUserOK().WithProfileHeader("pickles)" on the return (in the "if success" block). How can I set two header params?
func AuthLoginRouteHandler(params auth.AuthLoginUserParams) middleware.Responder {
transactionId := redFalconLogger.GetTransactionId()
redFalconLogger.LogDebug("AuthLoginRouteHandler", transactionId)
email := params.Body.Email
password := params.Body.Password
//Check to ensure that they are not nil
if email == "" || password == ""{
redFalconLogger.LogError("Got an empty string on a username/password", transactionId)
return auth.NewAuthLoginUserBadRequest()
}
//use pointers to limit in flight private data
pointerEmail := &email
pointerPassword := &password
//Call the auth domain
success := authDomain.LoginUser(pointerEmail,pointerPassword,transactionId)
if success {
return auth.NewAuthLoginUserOK().WithProfileKeyHeader("pickles")
}
redFalconLogger.LogDebug("Failed Login: ", transactionId)
return auth.NewAuthLoginUserBadRequest()
}
Thank you in advance.