Skip to content

Commit

Permalink
(PE-36076) Remove content type from certificate reject
Browse files Browse the repository at this point in the history
Previously, when a `DELETE` request was  sent to `puppet-ca/v1/certificate_status/<nodename>`
a 204 response was sent with a malformed content-type header. This commit removes the header.
  • Loading branch information
artlawson committed Aug 1, 2023
1 parent ba245f6 commit 2da7c9b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 6 additions & 3 deletions src/clj/puppetlabs/services/ca/certificate_authority_core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,12 @@
ca-settings :- ca/CaSettings]
(let [response (ca/delete-certificate-request! ca-settings subject)
outcomes->codes {:success 204 :not-found 404 :error 500}]
(-> (rr/response (:message response))
(rr/status ((response :outcome) outcomes->codes))
(rr/content-type "text/plain"))))
(if (= (response :outcome) :error)
(-> (rr/content-type ("text/plain"))
(rr/response (:message response))
(rr/status ((response :outcome) outcomes->codes)))
(-> (rr/response (:message response))
(rr/status ((response :outcome) outcomes->codes))))))

(schema/defn handle-get-ca-expirations
[ca-settings :- ca/CaSettings]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,6 @@
(is (false? (fs/exists? expected-path)))
(is (= 204 (:status response)))
(is (re-matches msg-matcher (:body response)))
(is (= "text/plain" (get-in response [:headers "Content-Type"])))
(is (logged? msg-matcher :debug)))
(finally
(fs/delete expected-path))))))
Expand All @@ -335,7 +334,6 @@
(is (false? (fs/exists? expected-path)))
(is (= 404 (:status response)))
(is (re-matches msg-matcher (:body response)))
(is (= "text/plain" (get-in response [:headers "Content-Type"])))
(is (logged? msg-matcher :warn)))))
(testing "Error during deletion of a CSR"
(logutils/with-test-logging
Expand Down

0 comments on commit 2da7c9b

Please sign in to comment.