1
0
mirror of synced 2025-12-20 10:28:40 -05:00

rest api enterprise hostname fix (#18095)

This commit is contained in:
Rachael Sewell
2021-03-18 22:16:14 -07:00
committed by GitHub
parent ec8cadaac0
commit 28ff566293
18 changed files with 22919 additions and 28017 deletions

View File

@@ -1,6 +1,5 @@
module.exports = createCodeSamples
const { URL } = require('url')
const urlTemplate = require('url-template')
const { stringify } = require('javascript-stringify')
const { get, mapValues, snakeCase } = require('lodash')
@@ -45,7 +44,7 @@ function toShellExample ({ route, serverUrl }) {
const args = [
method !== 'GET' && `-X ${method}`,
defaultAcceptHeader ? `-H "Accept: ${defaultAcceptHeader}"` : '',
new URL(path, serverUrl).href,
`${serverUrl}${path}`,
Object.keys(params).length && `-d '${JSON.stringify(params)}'`
].filter(Boolean)
return `curl \\\n ${args.join(' \\\n ')}`