简化开放下单幂等参数
This commit is contained in:
@@ -56,11 +56,6 @@ func (h *OpenV1Handler) CreateOrder(c *gin.Context) {
|
||||
response.BadRequest(c, "参数错误:client_order_no 与 sku 必填")
|
||||
return
|
||||
}
|
||||
if key := c.GetHeader("Idempotency-Key"); key != "" && key != req.ClientOrderNo {
|
||||
openlog.Warn(c, "create_order idempotency_key_mismatch header=%s body=%s", key, req.ClientOrderNo)
|
||||
response.BadRequest(c, "Idempotency-Key 必须与 client_order_no 一致")
|
||||
return
|
||||
}
|
||||
var data interface{}
|
||||
if len(req.Data) > 0 {
|
||||
var decoded interface{}
|
||||
|
||||
@@ -36,7 +36,7 @@ func Setup(h *Handlers) *gin.Engine {
|
||||
r.Use(cors.New(cors.Config{
|
||||
AllowOrigins: []string{"*"},
|
||||
AllowMethods: []string{"GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"},
|
||||
AllowHeaders: []string{"Origin", "Content-Type", "Authorization", "X-Merchant-ID", "X-App-Key", "X-Api-Key", "X-Timestamp", "X-Nonce", "X-Sign", "Idempotency-Key", "X-Request-ID"},
|
||||
AllowHeaders: []string{"Origin", "Content-Type", "Authorization", "X-Merchant-ID", "X-App-Key", "X-Api-Key", "X-Timestamp", "X-Nonce", "X-Sign", "X-Request-ID"},
|
||||
ExposeHeaders: []string{"Content-Length", "X-Request-ID"},
|
||||
AllowCredentials: true,
|
||||
}))
|
||||
|
||||
Reference in New Issue
Block a user