Skip to content

Commit

Permalink
自动检测json
Browse files Browse the repository at this point in the history
  • Loading branch information
windyfancy committed May 31, 2019
1 parent 81ce017 commit a28593b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/context.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,10 @@ module.exports = class Application extends Emitter {
var html="";
if(arguments.length==1){
if(typeof arguments[0]=="string" ){
html=arguments[0]
html=arguments[0];
if(html.startsWith("{")){
this.response.headers["Content-Type"]="application/json";
}
}else if(typeof arguments[0]=="object"){
let options=arguments[0];
options.context=this;
Expand Down

0 comments on commit a28593b

Please sign in to comment.