Skip to content

Commit ce58244

Browse files
committed
Updated download link, added filename header.
1 parent 689d567 commit ce58244

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

bin/test-fetch-csvs.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/bin/sh
22

3-
curl http://localhost:8000/server/?all
3+
curl "http://localhost:8000/server/?events-csv"

server/index.mal

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,10 @@
9696
(cond
9797
; a get request always returns a list of available CSVs
9898
(= (get vars "REQUEST_METHOD") "GET")
99-
(if (not (nil? (get ($ "_GET") "all")))
100-
(response "text/csv" (concatenate-all-csvs event-names))
99+
(if (not (nil? (get ($ "_GET") "events-csv")))
100+
(do
101+
(! header "Content-disposition: attachment; filename=events.csv")
102+
(response "text/csv" (concatenate-all-csvs event-names)))
101103
(response "application/json" (! json_encode event-names)))
102104

103105
; a PUT request writes a new line to the end of a CSV

0 commit comments

Comments
 (0)