Skip to content

Commit

Permalink
Merge branch 'fix-17' into fix-17-with-class
Browse files Browse the repository at this point in the history
  • Loading branch information
nickmccurdy committed Sep 6, 2017
2 parents ff466dd + ee3b8a8 commit 0fcd908
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/middleware/conditional-get.js
Expand Up @@ -14,7 +14,7 @@ module.exports = function (options) {
}
}

return async (next) => {
return async function (next) {
yield* etag.call(this, next);
if (this.request.fresh) this.response.status = 304;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/middleware/headers.js
Expand Up @@ -34,7 +34,7 @@ module.exports = function (app, options) {
// enable by default
if (nosniff != null) nosniff = true;

app.use(async (ctx, next) => {
app.use(async function (ctx, next) {
ctx.response.set('X-Powered-By', 'koala, koa');
if (hsts) ctx.response.set('Strict-Transport-Security', hsts);
if (nosniff) ctx.response.set('X-Content-Type-Options', 'nosniff');
Expand Down
6 changes: 3 additions & 3 deletions lib/middleware/pageNotFoundHandler.js
@@ -1,4 +1,4 @@
module.exports = async(ctx, next) => {
module.exports = async function (ctx, next) {
try {
await next()
const status = ctx.status || 404
Expand All @@ -12,10 +12,10 @@ module.exports = async(ctx, next) => {
ctx.status = err.status || 500
if (ctx.status === 404) {
//Your 404.jade
await ctx.render(`${__dirname}/404`)
await ctx.render(`${__dirname}/../templates/404`)
} else {
//other_error jade
await ctx.render('error', ctx)
await ctx.render(`${__dirname}/../templates/error`, ctx)
}
}
}
2 changes: 1 addition & 1 deletion lib/middleware/trace.js
@@ -1,7 +1,7 @@

var randomBytes = require('mz/crypto').randomBytes;

module.exports = async (ctx, next) => {
module.exports = async function (ctx, next) {
this.id = await randomBytes(24);

var req = ctx.req;
Expand Down
2 changes: 1 addition & 1 deletion test/app/basic-auth.js
Expand Up @@ -2,7 +2,7 @@
describe('Basic Auth', function () {
it('should return the value', function (done) {
var app = new Koala()
app.use(async (next) => {
app.use(async function (next) {
this.body = this.request.basicAuth
})

Expand Down

0 comments on commit 0fcd908

Please sign in to comment.