Skip to content

Commit 071e62c

Browse files
thervedavidejoneskayayarai
authored
Set accept header in curl examples (DataDog#14530)
* Set accept header in curl examples This makes it more clear for custom clients. * Fix rendering * skip content type on 204 responses * Update layouts/partials/api/curl.html Co-authored-by: Kari Halsted <12926135+kayayarai@users.noreply.github.com> Co-authored-by: david.jones <david.jones@datadoghq.com> Co-authored-by: Kari Halsted <12926135+kayayarai@users.noreply.github.com>
1 parent 5fbadd8 commit 071e62c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

layouts/partials/api/curl.html

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,16 @@
5353
{{- end -}}
5454
{{- end -}}
5555
{{- end -}}
56-
<span class="kn">"</span>
57-
56+
<span class="kn">"</span>&nbsp;\
57+
<span class="o">-H</span> <span class="s1">"Accept: application/json"</span>
5858
{{- /* Content-Type header based on "requestBody" */ -}}
59+
{{- if (or ($body) ($endpoint.action.requestBody)) -}}
60+
{{- with (index $endpoint.action.responses "204") -}}
61+
{{- else -}}
5962
&nbsp;\
6063
<span class="o">-H</span> <span class="s1">"Content-Type: {{ default "application/json" .contentType }}"</span>
64+
{{- end -}}
65+
{{- end -}}
6166

6267
{{- /* Render authentication in headers "DD-API-KEY: XXX" */ -}}
6368
{{- if isset $endpoint.action "security" -}}

0 commit comments

Comments
 (0)