title: Polymer Iron Ajax - How to access Response from Request after Error Event?
body: <p>I use iron-ajax:</p>
  
  <pre><code>&lt;iron-ajax
     id="postLoginForm"
     method="POST"
     verbose
     url="../../login"
     content-type="application/json"
     handle-as="json"
     on-response="_handleLoginResponse"
     on-error="_handleErrorResponse"&gt;&lt;/iron-ajax&gt;
  </code></pre>
  
  <p>The server always responds with an error if the request body is empty:</p>
  
  <blockquote>
    <p>Error: The request failed with status code: 422</p>
  </blockquote>
  
  <p>This triggers my <code>_handleErrorResponse</code> method in which I would like to access the actual response, which looks like this:</p>
  
  <blockquote>
    <p>{"email":["The email field is required."],"password":["The password field is required."]}</p>
  </blockquote>
  
  <p>Here is what my <code>_handleErrorResponse</code> looks like:</p>
  
  <pre><code>_handleErrorResponse: function (event) {
    console.log(event);
    console.log(event.detail);
    console.log(event.detail.error);
    console.log(event.detail.error.message);
    console.log(event.detail.request);
    console.log(event.detail.response);
    console.log(event.detail.request.response);
  },
  </code></pre>
  
  <p>And here is what the output looks like:</p>
  
  <p><a href="https://i.stack.imgur.com/4EeHP.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/4EeHP.jpg" alt="Developer Tools Output"></a></p>
  
  <p>So, how do I access the response so that I can output it to the view?</p>