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

Allow to use GET (not only POST) for /search endpoint #368

Open
Porok12 opened this issue Dec 26, 2023 · 3 comments
Open

Allow to use GET (not only POST) for /search endpoint #368

Porok12 opened this issue Dec 26, 2023 · 3 comments

Comments

@Porok12
Copy link

Porok12 commented Dec 26, 2023

Is there possibility to switch to version with GET (instead of POST) like python client has? I can only use GET method, POST will fail.

@Porok12
Copy link
Author

Porok12 commented Dec 26, 2023

My workaround:

diff --git a/node_modules/jira-client/lib/jira.js b/node_modules/jira-client/lib/jira.js
index b94c316..7381301 100644
--- a/node_modules/jira-client/lib/jira.js
+++ b/node_modules/jira-client/lib/jira.js
@@ -740,14 +740,12 @@ class JiraApi {
 
   searchJira(searchString, optional = {}) {
     return this.doRequest(this.makeRequestHeader(this.makeUri({
-      pathname: '/search'
-    }), {
-      method: 'POST',
-      followAllRedirects: true,
-      body: {
+      pathname: '/search',
+      query: {
         jql: searchString,
         ...optional
       }
+    }), {
+      followAllRedirects: true,
     }));
   }
   /** Create a Jira user

@Porok12 Porok12 changed the title Use GET instead of POST Allow to use GET (not only POST) for /search endpoint Dec 30, 2023
@Seth10001
Copy link
Contributor

Per their docs:

If the JQL query expression is too large to be encoded as a query parameter, use the POST version of this resource.

The benefit of using the POST method is larger search strings can be passed. Could you paste the error message you're reciveing when using the POST method?

@Porok12
Copy link
Author

Porok12 commented Dec 31, 2023

I'm getting 403 forbidden, maybe server don't have/handle post requests for some reason.

Query params can be very long so there should not be any problem with jql query lenght.

https://stackoverflow.com/questions/812925/what-is-the-maximum-possible-length-of-a-query-string#812962

Maybe lets user decide which one should be used?

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