mirror of
https://github.com/samsonjs/samhuri.net.git
synced 2026-03-25 09:05:47 +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
|
||||
if request.body.size > 0
|
||||
type = request['HTTP_CONTENT_TYPE']
|
||||
@fields =
|
||||
case
|
||||
when type =~ /^application\/json\b/
|
||||
when request.accept?('application/json')
|
||||
request.body.rewind
|
||||
JSON.parse(request.body.read)
|
||||
json = request.body.read
|
||||
JSON.parse(json)
|
||||
else
|
||||
params
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue