From 242cb9ec87e91758f0c2851798dcc377de1ce2b6 Mon Sep 17 00:00:00 2001 From: Fraser Tweedale Date: Tue, 5 Jul 2022 14:15:14 +1000 Subject: [PATCH] fix Accept header in HTTP requests The ClientOperation.ProducesMediaTypes field determines the value of the HTTP Accept header in requests. The current implementation causes /cacerts, /simpleenroll and /simplereenroll requests to be sent with header `Accept: text/plain`. This is incorrect, and can result in EST servers reponding with status 406 Not Acceptable. Use the correct value: `application/pkcs7-mime`. Signed-off-by: Fraser Tweedale --- apiclient/operation/operation_client.go | 6 +++--- apispec/rfc7030.yml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apiclient/operation/operation_client.go b/apiclient/operation/operation_client.go index 5b3942a..4c36e2f 100644 --- a/apiclient/operation/operation_client.go +++ b/apiclient/operation/operation_client.go @@ -37,7 +37,7 @@ func (a *Client) Cacerts(params *CacertsParams) (*CacertsOK, error) { ID: "cacerts", Method: "GET", PathPattern: "/cacerts", - ProducesMediaTypes: []string{"text/plain"}, + ProducesMediaTypes: []string{"application/pkcs7-mime"}, ConsumesMediaTypes: []string{""}, Schemes: []string{"https"}, Params: params, @@ -65,7 +65,7 @@ func (a *Client) Simpleenroll(params *SimpleenrollParams, authInfo runtime.Clien ID: "simpleenroll", Method: "POST", PathPattern: "/simpleenroll", - ProducesMediaTypes: []string{"text/plain"}, + ProducesMediaTypes: []string{"application/pkcs7-mime"}, ConsumesMediaTypes: []string{"application/pkcs10"}, Schemes: []string{"https"}, Params: params, @@ -94,7 +94,7 @@ func (a *Client) Simplereenroll(params *SimplereenrollParams, authInfo runtime.C ID: "simplereenroll", Method: "POST", PathPattern: "/simplereenroll", - ProducesMediaTypes: []string{"text/plain"}, + ProducesMediaTypes: []string{"application/pkcs7-mime"}, ConsumesMediaTypes: []string{"application/pkcs10"}, Schemes: []string{"https"}, Params: params, diff --git a/apispec/rfc7030.yml b/apispec/rfc7030.yml index 5132df3..6e673f3 100644 --- a/apispec/rfc7030.yml +++ b/apispec/rfc7030.yml @@ -40,7 +40,7 @@ paths: summary: Distribution of CA Certificates operationId: cacerts produces: - - text/plain + - application/pkcs7-mime responses: 200: description: successful operation @@ -68,7 +68,7 @@ paths: consumes: - application/pkcs10 produces: - - text/plain + - application/pkcs7-mime parameters: - name: certrequest in: body @@ -109,7 +109,7 @@ paths: consumes: - application/pkcs10 produces: - - text/plain + - application/pkcs7-mime parameters: - name: certrequest in: body