title: Configure Firebase Function to accept HAL+JSON as request body
body: <p>When using HTTP-triggered Functions in Firebase, I'm unable to access a HAL+JSON payload from the HTTP request.</p>
  
  <p>The request looks like:</p>
  
  <pre><code>POST /endpoint
  Content-Type: application/hal+json
  
  { /* some payload */ }
  </code></pre>
  
  <p>In my function I'm accessing the payload using <code>request.body</code>, like this:</p>
  
  <pre><code>...
  var myPayload = request.body;
  ...
  </code></pre>
  
  <p>The value of myPayload is:</p>
  
  <pre><code>{}
  </code></pre>
  
  <p>Instead, when the HTTP request contains <code>Content-Type: application/json</code>, the value of <code>myPayload</code> is the correct one:</p>
  
  <pre><code>{ /* some payload */ }
  </code></pre>
  
  <p>I believe it's related to the following: <a href="http://expressjs.com/en/api.html#express.json" rel="nofollow noreferrer">express.json()</a></p>
  
  <p>Is there a way to configure express in Firebase to include <code>application/hal+json</code>? For example:</p>
  
  <pre><code>express.json({
    type: [ 'application/json', 'application/hal+json' ]
  });
  </code></pre>
  
  <p>Or to access the raw body myself?</p>
  
  <p>Note: I don't want to create an express app within the function.</p>