Skip to content

Commit 2eb618a

Browse files
authored
Always include content type in GHES Manage API examples (#54959)
1 parent 0c42f65 commit 2eb618a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Diff for: src/rest/components/get-rest-code-samples.ts

+10
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,16 @@ export function getShellExample(
3939
contentTypeHeader = '-H "Content-Type: multipart/form-data"'
4040
}
4141

42+
// GHES Manage API requests differ from the dotcom API requests and make use of multipart/form-data and json content types
43+
if (operation.subcategory === 'manage-ghes') {
44+
// GET requests don't have a requestBody set, therefore let's default them to application/json
45+
if (operation.verb === 'get') {
46+
contentTypeHeader = '-H "Content-Type: application/json"'
47+
} else {
48+
contentTypeHeader = `-H "Content-Type: ${codeSample?.request?.contentType}"`
49+
}
50+
}
51+
4252
let requestPath = codeSample?.request?.parameters
4353
? parseTemplate(operation.requestPath).expand(codeSample.request.parameters)
4454
: operation.requestPath

0 commit comments

Comments
 (0)