Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: $this->request->getPost() is empty when json is send by postman #2720

Closed
uzairali001 opened this issue Mar 18, 2020 · 1 comment
Closed
Labels
bug Verified issues on the current code behavior or pull requests that will fix them

Comments

@uzairali001
Copy link

Describe the bug
When JSON data is sent via postman $this->request->getPost() always stays empty even $_POST stays empty. although file_get_contents('php://input') shows the data.

what could be the problem and how do I fix it?

CodeIgniter 4 version
4.0.2

Context

  • OS: Windows 10
  • Web server Apache 2.4.35
  • PHP version 7.4.0
@uzairali001 uzairali001 added the bug Verified issues on the current code behavior or pull requests that will fix them label Mar 18, 2020
@lonnieezell
Copy link
Member

First - please ask for support on the forums. We use GitHub for bug tracking.

Second - json data is never available as a POST variable in PHP. Try getJSON() instead. See this part of the user guide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified issues on the current code behavior or pull requests that will fix them
Projects
None yet
Development

No branches or pull requests

2 participants