Welcome Guest, Not a member yet? Register   Sign In
Requests received as GET rather than POST
#1

Planning to use CodeIgniter to set up an intermediary API. Following the instructions from Heroku and Code Igniter I performed the following steps:

  1. Created an empty directory and traversed into it
  2. composer create-project codeigniter4/appstarter --no-dev
  3. Removed unneeded files/directories (tests/ Home.php view_message.php .github/)
  4. Modified .env to have the following: CI_ENVIRONMENT = production, app.baseURL = 'https://my-app-99999.herokuapp.com/', and finally app.CSRFProtection  = false
  5. Modified App.php to have public $baseURL = 'https://my-app-99999.herokuapp.com/'; and public $indexPage = '';
  6. Modified Routes.php to not have a default controller and setAutoRoute(false) also removed the default route and instead $routes->resource('token')
  7. Created Token.php controller which extends ResourceController with create() method no index() method wherein create method does the following: return $this->respond($this->request->getPost());
  8. Create a Procfile with web: vendor/bin/heroku-php-apache2 public/
  9. git init followed by git add and git commit and finally heroku git:remote -a my-app-99999
  10. git heroku push master
So basically I'm trying to construct a simple test case which responds to a post on my-app-99999.herokuapp.com/token/. However, when using Postman to to send a post request to the URL I receive back a 501 json message that indicates that "index" action not implemented. Why is the request to that URL being interpreted as a get rather than a post? I know this works as expected because if I run php spark serve I get the post array returned when I use Postman at localhost:8080/token. What's causing the problem on the web side?
Reply


Messages In This Thread
Requests received as GET rather than POST - by grimpirate - 11-20-2020, 10:38 AM



Theme © iAndrew 2016 - Forum software by © MyBB