rpc_ts icon indicating copy to clipboard operation
rpc_ts copied to clipboard

Two questions

Open lighth7015 opened this issue 5 years ago • 4 comments

Hi, I have just recently stumbled across this, and it's basically perfect for my website, and have a couple questions about library use-

First question: Some of my API is GET-based. I'm having a difficult time working out how to specify what HTTP method my client will use. Second question: Seeing as some of my API uses GET requests, I can't pass parameters, how do I prevent internal errors from occurring when I supply no parameters to my GET-based APIs?

Thanks!

lighth7015 avatar Jul 06 '20 08:07 lighth7015

Hey, just wondering why you need the GET requests? The purpose of POST is so that we can always include a bundle of parameters and that we don't really need to think about it cause it's meant to be rpc. Is it impossible to switch to using POST?

ayroblu avatar Jul 06 '20 15:07 ayroblu

We use GET requests, because it's fetching static, unauthenticated (from the perspective of the API) data. I'm writing essentially a home-grown React CMS, and I need to GET information from an endpoint that uses the HTTP_REFERRER to figure out what site you're looking at. I know it's not great, but it's a start.

lighth7015 avatar Jul 06 '20 17:07 lighth7015

Sorry, I'm still not understanding why you can't use a POST request from your react app, the fact that it's static and unauthenticated is not an issue?

On Mon, 6 Jul 2020 at 18:00, Robert Butler [email protected] wrote:

We use GET requests, because it's fetching static, unauthenticated (from the perspective of the API) data. I'm writing essentially a home-grown React CMS, and I need to GET information from an endpoint that uses the HTTP_REFERRER to figure out what site you're looking at. I know it's not great, but it's a start.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/aiden/rpc_ts/issues/30#issuecomment-654355977, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABFQDYX7M5Q7V3Q6WUCNG33R2H7L3ANCNFSM4ORLNCKA .

ayroblu avatar Jul 06 '20 17:07 ayroblu

It's a pain to get POST requests to work on laravel, and I'd rather not unprotect routes just because they don't require authentication. It's just easier for me to work with GET requests, since these dont' need to pass any data. But either way, I'll figure something out. Thanks!

lighth7015 avatar Jul 06 '20 17:07 lighth7015