зеркало из https://github.com/github/docs.git
Fix single quote escaping for curl examples (#29876)
fix single quote escaping for curl examples
This commit is contained in:
Родитель
1897eb1c94
Коммит
0426962aec
|
@ -25,7 +25,10 @@ export function getShellExample(operation: Operation, codeSample: CodeSample) {
|
|||
|
||||
let requestBodyParams = ''
|
||||
if (codeSample?.request?.bodyParameters) {
|
||||
requestBodyParams = `-d '${JSON.stringify(codeSample.request.bodyParameters)}'`
|
||||
requestBodyParams = `-d '${JSON.stringify(codeSample.request.bodyParameters).replace(
|
||||
/'/g,
|
||||
"'\\''"
|
||||
)}'`
|
||||
|
||||
// If the content type is application/x-www-form-urlencoded the format of
|
||||
// the shell example is --data-urlencode param1=value1 --data-urlencode param2=value2
|
||||
|
|
Загрузка…
Ссылка в новой задаче