Implementation step definitions

Then, in spec/cucumber/steps/request.js, implement the following step definition:

When(/^set the HTTP header field (?:"|')?([\w-]+)(?:"|')? to (?:"|')?(.+)(?:"|')?$/, function (headerName, value) {  this.request.set(headerName, value);});When(/^sets the Authorization header to a valid token$/, function () {  this.request.set('Authorization', `Bearer ${this.token}`);});When(/^sets the Authorization header to a token with wrong signature$/, function () {  // Appending anything to the end of the signature will invalidate it  const tokenWithInvalidSignature = `${this.token}a`;  this.request.set('Authorization', `Bearer ${tokenWithInvalidSignature}`);});

Get Building Enterprise JavaScript Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.