New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.0 Breaking Changes #1178

Closed
hueniverse opened this Issue Nov 25, 2013 · 2 comments

Comments

Projects
None yet
3 participants
@hueniverse
Member

hueniverse commented Nov 25, 2013

Removed:

  • plugin.api() - use plugin.expose() instead.
  • name field when parsing multipart payload in file mode - use originalFilename instead.
  • request.info.address - use request.info.remoteAddress.
  • config.validate.response - use config.response.
  • Hawk and Bewitt hostHeaderName options - use hawk.hostHeaderName instead.
  • Response Obj constructor and update() now only support options, not type and encoding arguments.
  • server.addState() - use server.state().
  • server.addRoute(), server.addRoutes() - use server.route().
  • server.addHelper() - use server.helper().
  • pre.mode in route congif - pass an child array with all the methods you want to execute in parallel.
  • Obj response.update() - use response.raw before 'onPreResponse' is called to make changes directly, then in 'onPreResponse' return a new object to make changes (you can still reuse response.raw just not the response).
  • Built-in ALCE and confidence support. Use confidence new cli instead.
  • request.reply() - use handler second argument instead.
  • request.context - use this instead.
  • Support for using this as the request object in handlers.
  • Support for node 0.8 streams.
  • 'notFound' handler string value.
  • Plugin permissions (allow() and passing [] as options for plugins where [0] is the permissions).
  • Undocumented Hapi.client - use nipple instead.
  • Server-side route caching - route config.cache.mode.
  • File response type - use reply.file() instead.
  • response.varieties - use response.variety instead.
  • hapi.response - use reply() to generate response types.
  • response.isHapiResponse - check !response.isBoom.
  • reply.redirect() - use reply().redirect() instead.
  • error.trace, error.outterTrace - use error.stack.split('\n') instead.
  • request.generateView().
  • Server configuration auth - use server.auth.scheme() and server.auth.strategy() instead.
  • server.auth() - use server.auth.scheme() and server.auth.strategy() instead.
  • pack.auth() - use pack.auth.scheme() and pack.auth.strategy() instead.
  • normalizeRequestPath - this is now the default.
  • request.rawPayload - use request.payload and set to the required output and parse modes.
  • Route payload.mode - use payload.output, payload.parse, and payload.failAction instead.
  • Route and server payload.multipart - now always on. Use payload.uploads to set the temp directory.

Changed:

  • this in handler and ext is now bound to the context, not the request.
  • Response objects cannot be changed in 'onPreResponse'. A new response must be created to make changes.
  • Replaced joi 1.0 with 2.0 as the default and only option.
  • server.routingTable() to server.table().
  • server.maxSockets default value from null (use node's 5 sockets default) to Infinity.
  • Obj response payload is set at prepare time (right before 'onPreResponse' is called) instead of at construction. This might cause the payload to change after req.reply() is called if the obj ref provided is changed (which didn't happen in hapi 1.x).
  • plugin.context() to plugin.bind().
  • Route config.context to config.bind.
  • Obj response.raw is not response.source.
  • Content-type charset attribute now set on stream responses. Also, only set for application/json, application/javascript, and text/*.
  • request.log() no longer adds 'error' tag if data is Error.
  • reply().ttl() sets 'Cache-Control' header even if route has no cache config.
  • Server helpers default key generator algorithm changed (existing cache should be dropped).
  • Defaults Buffer responses to application/octet-stream.
  • response.uri() to response.location().
  • Redirection message no longer defaults to 'You are being redirected...'.
  • response.variety has new set of values: 'plain', 'buffer', 'stream', 'view', and 'file'.
  • Proxy postResponse config signature changed to function(request, reply, res, settings, ttl).
  • Replaced boom 1.0 with 2.0 which has a different internal structure.
  • 'internalError' events emitted when errors are set are response instead of after transmission. Also can now emit multiple errors per request.
  • In ext methods, calling next(null) will abort and send an empty response. Must be undefined to keep going.
  • authenticate() callback changed to function (err, result) and where result is { credentials: {...} }
  • Sets cache to 'private' is cookies are set.
  • request.payload is now always set and uses the output/parse payload settings to determine what it is.
  • Payload restrictions (maxBytes, allowed mime types) now affect all payload types.
  • Multipart always enabled and controlled by payload.output and payload.parse.
  • Response header() takes options instead of isAppend and sep.
  • CORS, Content-Length, Set-Cookie headers will not override existing set headers.
  • Server config files.relativeTo only accepts paths, not 'cwd' (use '.') or 'routes' (use __dirname).
  • redirectToSlash defaults to true.

@ghost ghost assigned hueniverse Nov 25, 2013

@adambrault

This comment has been minimized.

Show comment
Hide comment
@adambrault

adambrault Jan 13, 2014

Also relevant to anyone interested in this list: travelogue@0.4.4 wants hapi@1.x.x (issue)

adambrault commented Jan 13, 2014

Also relevant to anyone interested in this list: travelogue@0.4.4 wants hapi@1.x.x (issue)

@devfacet

This comment has been minimized.

Show comment
Hide comment
@devfacet

devfacet Jan 26, 2014

Contributor

For the records...

pack.allow({ ext: true }).require() >>>>> pack.require()
https://github.com/spumko/yar/blob/master/README.md (This file is old)

request.reply() >>>>> function handler(request, reply)
#1194 (This breaking changes must handle manually)

Contributor

devfacet commented Jan 26, 2014

For the records...

pack.allow({ ext: true }).require() >>>>> pack.require()
https://github.com/spumko/yar/blob/master/README.md (This file is old)

request.reply() >>>>> function handler(request, reply)
#1194 (This breaking changes must handle manually)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment