Просмотр исходного кода

Return 200 instead of 201 on provisioner webhook update

PUT (update) is not a resource-creation operation, so it should not
return 201 Created. Verified safe against the shipped ca.AdminClient,
which only checks for status >= 400.
Thorsten Spieker 4 месяцев назад
Родитель
Сommit
4913ab2f38
2 измененных файлов с 2 добавлено и 2 удалено
  1. 1 1
      authority/admin/api/webhook.go
  2. 1 1
      authority/admin/api/webhook_test.go

+ 1 - 1
authority/admin/api/webhook.go

@@ -229,5 +229,5 @@ func (war *webhookAdminResponder) UpdateProvisionerWebhook(w http.ResponseWriter
 		Auth:                 newWebhook.Auth,
 		Auth:                 newWebhook.Auth,
 		DisableTlsClientAuth: newWebhook.DisableTlsClientAuth,
 		DisableTlsClientAuth: newWebhook.DisableTlsClientAuth,
 	}
 	}
-	render.ProtoJSONStatus(w, whResponse, http.StatusCreated)
+	render.ProtoJSONStatus(w, whResponse, http.StatusOK)
 }
 }

+ 1 - 1
authority/admin/api/webhook_test.go

@@ -632,7 +632,7 @@ func TestWebhookAdminResponder_UpdateProvisionerWebhook(t *testing.T) {
 					Url:  "https://example.com",
 					Url:  "https://example.com",
 					Kind: linkedca.Webhook_ENRICHING,
 					Kind: linkedca.Webhook_ENRICHING,
 				},
 				},
-				statusCode: 201,
+				statusCode: 200,
 			}
 			}
 		},
 		},
 	}
 	}