title: How to get response code from curl in a jenkinsfile
body: <p>In a jenkinsfile I call curl with:</p>
  
  <pre><code>sh "curl -X POST -i -u admin:admin https://[myhost]"
  </code></pre>
  
  <p>and I get output like this:</p>
  
  <pre><code>...
  HTTP/1.1 204 No Content
  Server: Apache-Coyote/1.1
  ...
  </code></pre>
  
  <p>I would like to take different actions based on the response code from the above call but how do I store only the response code/reply in a variable?</p>