title: Get plain text from REST response
body: <p>I use fetch to get data from my REST service. Once the Response arrives, I want to get the error message, if any, and display it to the user (the user is mostly me).</p>
  
  <pre><code>fetch(address, attributes).then(response =&gt; {
      if (!response.ok) {
          if (response.status === 404) {
              return {
                  text: "Server not found!",
                  status: "danger"
              };
          }
          return {
              text: response.text(),
              status: "danger"
          };
      }
      return {
          text: "Success!",
          status: "success"
      };
  }
  </code></pre>
  
  <p>The <code>response.text()</code> part is the important one: My Backend sends a javax.rs Reponse with a String as entity, e.g. "Error". Here, I want to read it, but response.text() returns only a Promise object which only returns more Promise objects when resolved.</p>
  
  <p>I also tried using <code>{"msg":"[error]"}</code> and then parse it here as <code>reponse.json().msg</code> instead, but that didn't work either.</p>