<p>See <a href="https://stackoverflow.com/a/12018482/684">here</a> for various methods of setting the response code depending on what version of PHP and which PHP module you're running.</p>

CC BY-SA 3.0
2015-02-27T19:35:06.203Z
2015-02-27T19:35:06.203Z
2017-05-23T12:38:53.957Z
Brad Bell
<p>I’ve tried <code>HeaderHelper::setHeader(array('code' =&gt; 200))</code> without success.</p>

CC BY-SA 3.0
2015-02-27T18:21:59.597Z
Can you give a little more context/code examples about what you're trying to do?  Craft will do some automatic header response code setting depending on the type of request it is.
Brad Bell
CC BY-SA 3.0
2015-02-27T19:20:11.747Z
I was trying to set it as a response to a web hook. 200 for a successful function, or appropriate respone if something went wrong.
James
CC BY-SA 3.0
2015-03-06T10:04:53.350Z
This is maybe more appropriate: http://craftcms.stackexchange.com/questions/478/render-generic-message-error-template-from-plugin
James
<plugin-development><json>
How to set a response 200 from a plugin?
# How to set a response 200 from a plugin?

(Asked by: username_0 on 2015-02-27)

I’ve tried `HeaderHelper::setHeader(array('code' => 200))` without success.

**Tags:** plugin-development, json
> **Comments:**
> **username_1**: Can you give a little more context/code examples about what you're trying to do?  Craft will do some automatic header response code setting depending on the type of request it is.  
> **username_0**: I was trying to set it as a response to a web hook. 200 for a successful function, or appropriate respone if something went wrong.  
> **username_0**: This is maybe more appropriate: http://craftcms.stackexchange.com/questions/478/render-generic-message-error-template-from-plugin  

---

## 1 answers

### Answer by username_1 on 2015-02-27. Score: 3 | Accepted answer

See [here](https://stackoverflow.com/a/12018482/684) for various methods of setting the response code depending on what version of PHP and which PHP module you're running.


---

