From 871b52a2884c9d5330fa9cd27bc7982660cd4765 Mon Sep 17 00:00:00 2001 From: Julien Neuhart Date: Tue, 26 Mar 2019 17:35:38 +0100 Subject: [PATCH] adding filename form field + updating echo package to v4 (#57) --- build/docs/content/08-filename.md | 27 +++++++++++++ .../{08-scalability.md => 09-scalability.md} | 0 .../{09-liveness.md => 10-liveness.md} | 0 .../docs/content/{10-fonts.md => 11-fonts.md} | 0 .../docs/content/{11-links.md => 12-links.md} | 0 docs/index.html | 39 +++++++++++++++++++ go.mod | 12 ++++-- go.sum | 32 +++++++++------ internal/app/api/api.go | 13 ++++--- internal/app/api/api_test.go | 2 +- internal/app/api/html.go | 2 +- internal/app/api/html_test.go | 2 +- internal/app/api/markdown.go | 2 +- internal/app/api/markdown_test.go | 2 +- internal/app/api/merge.go | 11 ++++-- internal/app/api/merge_test.go | 2 +- internal/app/api/office.go | 2 +- internal/app/api/office_test.go | 2 +- internal/app/api/resource.go | 33 +++++++++------- internal/app/api/url.go | 2 +- internal/app/api/url_test.go | 2 +- 21 files changed, 140 insertions(+), 47 deletions(-) create mode 100644 build/docs/content/08-filename.md rename build/docs/content/{08-scalability.md => 09-scalability.md} (100%) rename build/docs/content/{09-liveness.md => 10-liveness.md} (100%) rename build/docs/content/{10-fonts.md => 11-fonts.md} (100%) rename build/docs/content/{11-links.md => 12-links.md} (100%) diff --git a/build/docs/content/08-filename.md b/build/docs/content/08-filename.md new file mode 100644 index 00000000..d330d121 --- /dev/null +++ b/build/docs/content/08-filename.md @@ -0,0 +1,27 @@ +--- +title: Filename +--- + +All endpoints accept a form field named `filename`. + +If provided, the API will return the resulting PDF file with the given filename. +Otherwise a random filename is used. + +> The Go and PHP libraries do not provide a way to set this form field. +> However, you may hijack the response from the API or store the resulting PDF +> using a custom filename. +> +> **Attention:** this feature does not work if a form field `webhookURL` is given. + +## Examples + +### cURL + +```bash +$ curl --request POST \ + --url http://localhost:3000/convert/html \ + --header 'Content-Type: multipart/form-data' \ + --form files=@index.html \ + --form filename='result.pdf' \ + -o result.pdf +``` \ No newline at end of file diff --git a/build/docs/content/08-scalability.md b/build/docs/content/09-scalability.md similarity index 100% rename from build/docs/content/08-scalability.md rename to build/docs/content/09-scalability.md diff --git a/build/docs/content/09-liveness.md b/build/docs/content/10-liveness.md similarity index 100% rename from build/docs/content/09-liveness.md rename to build/docs/content/10-liveness.md diff --git a/build/docs/content/10-fonts.md b/build/docs/content/11-fonts.md similarity index 100% rename from build/docs/content/10-fonts.md rename to build/docs/content/11-fonts.md diff --git a/build/docs/content/11-links.md b/build/docs/content/12-links.md similarity index 100% rename from build/docs/content/11-links.md rename to build/docs/content/12-links.md diff --git a/docs/index.html b/docs/index.html index 975fc822..aeb4d6ea 100755 --- a/docs/index.html +++ b/docs/index.html @@ -74,6 +74,10 @@ Webhook +
+ Filename +
+
Scalability
@@ -898,6 +902,41 @@ $resp = $client->post($request); +
+

Filename

+

All endpoints accept a form field named filename.

+ +

If provided, the API will return the resulting PDF file with the given filename. +Otherwise a random filename is used.

+ +
+

The Go and PHP libraries do not provide a way to set this form field. +However, you may hijack the response from the API or store the resulting PDF +using a custom filename.

+ +

Attention: this feature does not work if a form field webhookURL is given.

+
+ +

Examples

+ +

cURL

+ +
$ curl --request POST \
+    --url http://localhost:3000/convert/html \
+    --header 'Content-Type: multipart/form-data' \
+    --form files=@index.html \
+    --form filename='result.pdf' \
+    -o result.pdf
+
+ +
+