Commit f8c6577a authored by Cloud User's avatar Cloud User

fix http kong request id

parent 22d7f095
...@@ -77,7 +77,7 @@ var producerMessagesBytes = make(chan bytesAndHeader, 1000) ...@@ -77,7 +77,7 @@ var producerMessagesBytes = make(chan bytesAndHeader, 1000)
var consumerMessages = make(chan string) var consumerMessages = make(chan string)
const TaskIdAtrr = "Task-Id" const TaskIdAtrr = "Task-Id"
const RequestId = "Request_Id" const RequestId = "X-Kong-Request-Id"
func kafkaProducerBytes() { func kafkaProducerBytes() {
...@@ -1015,6 +1015,10 @@ func ApiOrJWT(c *fiber.Ctx) error { ...@@ -1015,6 +1015,10 @@ func ApiOrJWT(c *fiber.Ctx) error {
reqHeaders := c.GetReqHeaders() reqHeaders := c.GetReqHeaders()
// for k, v := range reqHeaders {
// fmt.Println("k", k, "v", v)
// }
if taskHeaders, ok := reqHeaders[TaskIdAtrr]; ok { if taskHeaders, ok := reqHeaders[TaskIdAtrr]; ok {
if taskHeaders == nil || len(taskHeaders) == 0 { if taskHeaders == nil || len(taskHeaders) == 0 {
return c.SendString(fmt.Sprintf("Please provide http header %s value, right now the value is %v.", TaskIdAtrr, taskHeaders)) return c.SendString(fmt.Sprintf("Please provide http header %s value, right now the value is %v.", TaskIdAtrr, taskHeaders))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment