MCPcopy Index your code
hub / github.com/github/docs / renderStatusCodes

Method renderStatusCodes

src/rest/scripts/utils/operation.js:118–142  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

116 }
117
118 async renderStatusCodes() {
119 const responses = this.#operation.responses
120 const responseKeys = Object.keys(responses)
121 if (responseKeys.length === 0) return []
122
123 this.statusCodes = await Promise.all(
124 responseKeys.map(async (responseCode) => {
125 const response = responses[responseCode]
126 const httpStatusCode = responseCode
127 const httpStatusMessage = httpStatusCodes.getMessage(Number(responseCode), 'HTTP/2')
128 // The OpenAPI should be updated to provide better descriptions, but
129 // until then, we can catch some known generic descriptions and replace
130 // them with the default http status message.
131 const responseDescription =
132 response.description.toLowerCase() === 'response'
133 ? await renderContent(httpStatusMessage)
134 : await renderContent(response.description)
135
136 return {
137 httpStatusCode,
138 description: responseDescription,
139 }
140 })
141 )
142 }
143
144 async renderParameterDescriptions() {
145 return Promise.all(

Callers 1

processMethod · 0.95

Calls 1

renderContentFunction · 0.85

Tested by

no test coverage detected