Mercurial Hosting > luan
comparison src/luan/webserver/RequestParser.java @ 1258:e4d7a3114fa8
support "Content-Type: application/json; charset=utf-8"
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 20 Sep 2018 22:11:11 -0600 |
parents | c147e2e877e3 |
children | e8020216dee7 |
comparison
equal
deleted
inserted
replaced
1257:e38f5869e9df | 1258:e4d7a3114fa8 |
---|---|
262 parser.rollback(); | 262 parser.rollback(); |
263 throw new ParseException(parser,e); | 263 throw new ParseException(parser,e); |
264 } | 264 } |
265 } | 265 } |
266 | 266 |
267 // improve later | |
268 void parseJson() throws UnsupportedEncodingException { | |
269 if( request.body == null ) { | |
270 logger.warn("body is null\n"+request.rawHead); | |
271 return; | |
272 } | |
273 String contentType = (String)request.headers.get("content-type"); | |
274 if( !contentType.equals("application/json; charset=utf-8") ) | |
275 throw new RuntimeException(contentType); | |
276 String value = new String(request.body,"utf-8"); | |
277 Util.add(request.parameters,"json",value); | |
278 } | |
279 | |
267 } | 280 } |