Skip to content

Commit 8d912df

Browse files
committed
utils: cors
1 parent 12864d3 commit 8d912df

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

src/utils/cors.cr

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# This file is part of MoonScript
2+
#
3+
# MoonSript is free software: you can redistribute it and/or modify
4+
# it under the terms of the GNU General Public License as published by
5+
# the Free Software Foundation, either version 3 of the License, or
6+
# (at your option) any later version.
7+
#
8+
# MoonSript is distributed in the hope that it will be useful,
9+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
# GNU General Public License for more details.
12+
#
13+
# You should have received a copy of the GNU General Public License
14+
# along with MoonSript. If not, see <https://www.gnu.org/licenses/>.
15+
#
16+
# Copyright (C) 2025 Krisna Pranav, MoonScript Developers
17+
18+
module MoonScript
19+
class CORS
20+
include HTTP::Handler
21+
22+
def call(context)
23+
context.response.headers["Accept-Control-Max-Age"] = 1.day.total_seconds.to_i.to_s
24+
context.response.headers["Acccess-Control-Allow-Method"] = "GET, POSt, PUT, PATCH"
25+
end
26+
end
27+
end

0 commit comments

Comments
 (0)