Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
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

[useCubeQuery / React] How change to HTTP Method Post ? #8386

Closed
mayconline opened this issue Jun 24, 2024 · 3 comments
Closed

[useCubeQuery / React] How change to HTTP Method Post ? #8386

mayconline opened this issue Jun 24, 2024 · 3 comments
Assignees
Labels
question The issue is a question. Please use Stack Overflow for questions.

Comments

@mayconline
Copy link

mayconline commented Jun 24, 2024

Problem

Using useCubeQuery, how change to HTTP Method Post ?

import { useCubeQuery } from "@cubejs-client/react";

const result = useCubeQuery(query, options);

this docs https://cube.dev/docs/reference/rest-api#v1load,
"# Use POST to fix problem with query length limits"

It said to change the post method to fix this error, but I didn't find where it is possible to change the method.

@mayconline mayconline added the question The issue is a question. Please use Stack Overflow for questions. label Jun 24, 2024
@igorlukanin
Copy link
Member

Hi @mayconline 👋

I've checked the source code and I can confirm that the useCubeQuery hook as well as other utilities from Cube's JavaScript SDK will automatically switch from GET to POST when needed, no manual action is required.

Did you face any issues yourself?

@igorlukanin igorlukanin self-assigned this Jun 26, 2024
@mayconline
Copy link
Author

Hi, Morning, I was trying to do this manually, trying to pass some prop to it to become a POST.

Is there any way to do it?

I was having a problem with my query, but I don't know if it reached the 2000 character limit, because it wasn't always going as GET.

Anyway, I changed the way it is being done, and it stopped giving errors, but it would be nice to have this option to change the manual GET to POST, for future problems that may arise.

@igorlukanin
Copy link
Member

If you have a code example that can help reproduce errors, I'd be happy to take a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question The issue is a question. Please use Stack Overflow for questions.
Projects
None yet
Development

No branches or pull requests

2 participants