Skip to content

1.0.0 Breaking Changes #735

@hueniverse

Description

@hueniverse

Note: Once 1.0.0 is out, hapi will obey semver rules where 1.x.x will never include breaking changes (until 2.0.0).

Changed:

  • request.rawBody renamed to request.rawPayload, and is now a Buffer, not a string. Use request.rawPayload.toString() to get the previously provided value (0.16 and older).
  • Module root now case sensitive (Server, Pack, response, Composer, state, types, utils).
  • pack.version() changed to pack.version.
  • Server config views.cache and views.engines[ext].cache changed to isCached.
  • Server config views no longer includes a default handlebars handler. To get the same behavior add engines: { 'html': 'handlebars' } to the views object.
  • If multiple view engines are defined, it will no longer try looking for all the extensions if template name is missing it. Set views.defaultExtension when using multiple extensions engines.
  • Route config response moved to validate.response.
  • Route auth.tos changed from number to semver version.
  • Cookie errors are logged when state.cookies.failAction to to 'error'.
  • Replaced request.reply.payload().send() with just request.reply() (uses process.nextTick() to schedule an automatic send()). Added new hold() method to prevent next tick from sending the response, until send() is called.
  • request.reply.send() only available after calling request.reply().hold().
  • Location header prefixed with server.settings.location is set and value non-absolute (instead if using server.info.uri).
  • server.plugin renamed server.pack.
  • Basic auth changed. Details in https://github.com/spumko/hapi/blob/master/docs/API.md#basic-authentication.
  • Cookie auth validateFunc changed. Details in https://github.com/spumko/hapi/blob/master/docs/API.md#cookie-authentication.
  • In server.helper(), options.generateKey function signature changed to pass the same arguments as the helper method instead of passing them as a single arguments object.
  • Composer manifest no longer has root permissions. Instead, pass [permissions, options] as the options value of each plugin key.

Removed:

  • Cache strict mode.
  • request.reply.raw() and the Raw response type. In node 0.10 it is trivial to create your own Readable stream and use that to achieve the same result.
  • Oz auth scheme (but you were not supposed to use it anyway).
  • Hapi.response.generate() changed to private.
  • Server config views.engine. Use views.engines[ext].module instead.
  • Route config validate.response.failAction - ignore value.
  • request.reply.payload() and request.reply.stream() removed. Use request.reply() instead.
  • server.settings.host, server.settings.port, server.settings.uri. Moved to server.info.
  • server.settings.nickname.
  • request.removeTail().

Obsoleted:

  • request.addTail(). Use request.tail().

Metadata

Metadata

Assignees

No one assigned

    Labels

    breaking changesChange that can breaking existing code

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions