mirror of
https://github.com/samsonjs/samhuri.net.git
synced 2026-04-27 14:57:40 +00:00
fix accepting JSON
This commit is contained in:
parent
eb471b0d24
commit
be88d907a0
1 changed files with 3 additions and 3 deletions
|
|
@ -74,12 +74,12 @@ blog = HarpBlog.new($config[:path], $config[:dry_run])
|
||||||
|
|
||||||
before do
|
before do
|
||||||
if request.body.size > 0
|
if request.body.size > 0
|
||||||
type = request['HTTP_CONTENT_TYPE']
|
|
||||||
@fields =
|
@fields =
|
||||||
case
|
case
|
||||||
when type =~ /^application\/json\b/
|
when request.accept?('application/json')
|
||||||
request.body.rewind
|
request.body.rewind
|
||||||
JSON.parse(request.body.read)
|
json = request.body.read
|
||||||
|
JSON.parse(json)
|
||||||
else
|
else
|
||||||
params
|
params
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue