{% assign content_type = {{ include.content_type | default: 'application/json' }} -%} {% capture default_curl_data %}{% raw %}{}{% endraw %}{% endcapture -%} {% assign curl_data = include.curl_data | default: page.curl_data | default: default_curl_data -%}
{%- if include.empty %} Does not accept a body {% else %} {{ content_type }}
{{ include.contents }}
{%- endif %}

Example Curl


        {%- capture headers %}
        {%- unless include.empty %}-H "Content-Type: {{ content_type }}" {% endunless %}
        {%- endcapture %}
        $ curl -X{{ page.method }} {{ headers -}}
        http://localhost:8080{{ page.endpoint }}
        {%- unless include.empty %} \
          -d '{{ curl_data }}'
        {%- endunless %}