bcosca / fatfree

A powerful yet easy-to-use PHP micro-framework designed to help you build dynamic and robust Web applications - fast!
2.66k stars 446 forks source link

How to return a HTTP 201 code #1154

Closed wranger closed 5 years ago

wranger commented 5 years ago

Hi, I have implemented a Rest-Interface with f3, but the client expects an http 201 return code as a result of an POST. When i trigger an f3->error(201), f3 sends also an error message:


<!DOCTYPE html>
<html>
<head><title>201 Created</title></head>
<body>
<h1>Created</h1>
<p>HTTP 201 (POST /quota/uid)</p>
<pre>[app/controllers/TestController:97] Base->error()
[lib/base.php:1873] TestController->post()
[lib/base.php:1673] Base->call()
[index.php:57] Base->run()
</pre>
</body>
</html>

Is there a way to get only the 201 response?

pauljherring commented 5 years ago

$f3->status(201);

This is really a question that is better asked on the discussion forum:

https://groups.google.com/forum/#!forum/f3-framework

wranger commented 5 years ago

thanks