php - Swagger.io Slim Framework POST errors -
i used swagger generate slim framework server. without editing anything, testing basic functions. have 1 located @ /user/login
. here script have it:
$app = new slim\app(); $app->post('/user/login', function($request, $response, $args) { $queryparams = $request->getqueryparams(); $username = $queryparams['username']; $password = $queryparams['password']; $response->write("will not work"); return $response; }); $app->get('/user/{user_id}', function($request, $response, $args) { $response->write('works'); return $response; });
however, when try post
url using postman (chrome app), results in 500 error. if try of get
methods, works. seems happening post
methods.
i have running on ubuntu machine, apache2 installed php. have updated latest available versions. modrewrite
enabled, , override set all. please help! @ such loss @ point.
i found error.
notice have 2 urls, 1 @ /user/login
, /user/{user_id}
, because of 2 starting /user
urls, confuses , doesn't know use, resulting in 500 error.
switching /user/login
/login
corrected issue.
i feel stupid not knowing happen.
Comments
Post a Comment