@rip-lang/api 0.7.1 → 0.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api.rip +3 -4
- package/package.json +1 -1
package/api.rip
CHANGED
|
@@ -90,19 +90,18 @@ createContext = (req, params = {}) ->
|
|
|
90
90
|
|
|
91
91
|
ctx =
|
|
92
92
|
json: (data, status = 200, headers = {}) ->
|
|
93
|
-
for k, v of headers then out.set(k, v)
|
|
94
93
|
out.set 'Content-Type', 'application/json'
|
|
95
|
-
out.set
|
|
94
|
+
for k, v of headers then out.set(k, v)
|
|
96
95
|
new Response JSON.stringify(data), { status, headers: out }
|
|
97
96
|
|
|
98
97
|
text: (str, status = 200, headers = {}) ->
|
|
99
|
-
for k, v of headers then out.set(k, v)
|
|
100
98
|
out.set 'Content-Type', 'text/plain; charset=UTF-8'
|
|
99
|
+
for k, v of headers then out.set(k, v)
|
|
101
100
|
new Response str, { status, headers: out }
|
|
102
101
|
|
|
103
102
|
html: (str, status = 200, headers = {}) ->
|
|
104
|
-
for k, v of headers then out.set(k, v)
|
|
105
103
|
out.set 'Content-Type', 'text/html; charset=UTF-8'
|
|
104
|
+
for k, v of headers then out.set(k, v)
|
|
106
105
|
new Response str, { status, headers: out }
|
|
107
106
|
|
|
108
107
|
redirect: (location, status = 302) ->
|