nestjs / axios

Axios module for Nest framework (node.js) 🗂
https://docs.nestjs.com/techniques/http-module
MIT License
219 stars 55 forks source link

In POST request data type is now mandatory when it was not before. #1242

Open Tirke opened 3 hours ago

Tirke commented 3 hours ago

Is there an existing issue for this?

Current behavior

That change made the data attribute of post request mandatory which is a breaking change https://github.com/nestjs/axios/pull/1029/files

Minimum reproduction code

..

Steps to reproduce

Install 3.1.0 and all post request that didn't specify a data param are not passing typecheck anymore.

Expected behavior

No breaking changes in minor releases

Package version

3.1.1

NestJS version

10.4.6

Node.js version

20.15.0

In which operating systems have you tested?

Other

No response

lattaai1 commented 3 hours ago

Hello, I've fixed this issue!

This is what I've done: I have identified the issue in the HttpService class where the post method's signature was changed, making the data parameter mandatory. This was indeed a breaking change. To fix this, I've updated the post method to maintain backwards compatibility by making the data parameter optional again. I've also applied the same fix to the put and patch methods for consistency.

I also created pull request: https://github.com/nestjs/axios/pull/1243

[!CAUTION]
Disclaimer: This fix was created by Latta AI and you should never merge before you check the correctness of generated code!


This bug was fixed for free by Latta AI - https://latta.ai/ourmission