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

When making a POST request, I am unable to retrieve the payload correctly. #439

Closed
eyedroot opened this issue May 9, 2023 · 1 comment
Closed

Comments

@eyedroot
Copy link

eyedroot commented May 9, 2023

Versions

  • laravel/framework ^10.9.0
  • spatie/laravel-data ^3.5.0

Reproduction

  • POST /api/esports/cheer
    • {
      	"match_id": 1,
      	"team_id": 2
      }
  • Controller
     public function addCheerPointTeam(CheerPointTeamRequest $request)
     {
         return $this->serviceV2->addCheerPointTeam(
             $request->matchId,
             $request->teamId,
         );
     }
  • CheerPointTeamRequest
     #[MapInputName(SnakeCaseMapper::class)]
     class CheerPointTeamRequest extends Data
     {
         public function __construct(
             #[Required]
             public readonly int $matchId,
     
             #[Required]
             public readonly int $teamId,
         ) {
         }
     }

Output

Could not create App\Http\Controllers\CheerPointTeamRequest: the constructor requires 2 parameters, 0 given.

Prior to version 3.4.4, it was functioning correctly, but after updating to 3.5.0, the payloads are not being properly mapped in POST requests.

@rubenvanassche
Copy link
Member

This has todo with #432, we're going to release v3.5.1 without this feature and iron out the kinks in v4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants