mirror of
https://github.com/foss42/apidash.git
synced 2025-06-17 20:16:27 +08:00
added request body payload templates
This commit is contained in:
@ -23,6 +23,23 @@ require 'faraday/multipart'
|
|||||||
|
|
||||||
final String kTemplateRequestUrl = """
|
final String kTemplateRequestUrl = """
|
||||||
\nREQUEST_URL = URI("{{ url }}")\n\n
|
\nREQUEST_URL = URI("{{ url }}")\n\n
|
||||||
|
""";
|
||||||
|
|
||||||
|
final String kTemplateBody = """
|
||||||
|
PAYLOAD = <<-{{ boundary }}
|
||||||
|
{{ body }}
|
||||||
|
{{ boundary }}\n\n
|
||||||
|
""";
|
||||||
|
|
||||||
|
final String kTemplateFormParamsWithFile = """
|
||||||
|
PAYLOAD = {
|
||||||
|
{% for param in params %}{% if param.type == "text" %} "{{ param.name }}" => Faraday::Multipart::ParamPart.new("{{ param.value }}", "text/plain"),
|
||||||
|
{% elif param.type == "file" %} "{{ param.name }}" => Faraday::Multipart::FilePart.new("{{ param.value }}", "application/octet-stream"),{% endif %}{% endfor %}
|
||||||
|
}\n\n
|
||||||
|
""";
|
||||||
|
|
||||||
|
final String kTemplateFormParamsWithoutFile = """
|
||||||
|
PAYLOAD = URI.encode_www_form({\n{% for param in params %} "{{ param.name }}" => "{{ param.value }}",\n{% endfor %}})\n\n
|
||||||
""";
|
""";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user