1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-04 00:18:01 +01:00

feat: update ApiRequest to accept POST w/o payloads

This commit is contained in:
Thomas Heartman 2022-04-27 10:55:33 +02:00
parent 9a0226d158
commit 65da8a845a
2 changed files with 12 additions and 1 deletions

View File

@ -31,6 +31,13 @@ POST.args = {
title: 'Create a feature toggle with impression data enabled. (example)', title: 'Create a feature toggle with impression data enabled. (example)',
}; };
export const POSTWithoutPayload = Template.bind({});
POSTWithoutPayload.args = {
verb: 'post',
url: 'api/admin/projects/<projectId>/features/<featureName>/environments/<environment>/on',
title: 'Disable a toggle in an env.',
};
export const PUT = Template.bind({}); export const PUT = Template.bind({});
PUT.args = { PUT.args = {
verb: 'put', verb: 'put',

View File

@ -68,6 +68,9 @@ curl -H "Content-Type: application/json" \\
<${baseUrl}>/${url}` <${baseUrl}>/${url}`
).trim(); ).trim();
const httpieBlockFormatSpecifier =
verbUpper === 'POST' && !prettyPayload ? '--json' : '';
const httpieBlock = ( const httpieBlock = (
payload payload
? `echo '${prettyPayload}' \\ ? `echo '${prettyPayload}' \\
@ -77,7 +80,8 @@ curl -H "Content-Type: application/json" \\
: ` : `
http ${verbUpper} \\ http ${verbUpper} \\
<${baseUrl}>/${url} \\ <${baseUrl}>/${url} \\
Authorization:<${authToken}>`.trim() Authorization:<${authToken}> \\
${httpieBlockFormatSpecifier}`.trim()
).trim(); ).trim();
return ( return (