fix accepting JSON

This commit is contained in:
Sami Samhuri 2015-04-19 16:25:21 -07:00
parent eb471b0d24
commit be88d907a0

View file

@ -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