I am using IntelliJ 2022.3.1 (Ultimate Edition).
I have multiple .http files containing GRAPHQL requests, for convenience, those files are kept in a subfolder of resource folder in test package, in our Java application. Those requests are defined in multiple files, because for many of them the query is rather big and it was hard to navigate in a single file.
My goal is to make running these queries as easy as possible, to ease testing.
I have already added environment variables with some details, like hostname or token‚ which I set in the headers.
I have also defined live template to prepare request headers quickly, when adding new request.
What I would like to do in addition is:
read query from a file
run queries from all the files with one click
The first problem is:
When I have a GRAPHQL request in .http file, I can successfully trigger it. But when I save exactly the same query in a file and try to load it when triggering request, I get validation exceptions. Is this not possible?
For example, this request works fine:
GRAPHQL {{path}}
Authorization Bearer {{token}}
Content-Type: application/graphql
query {
total {
amount
currency
}
}
But after saving the same query in a file and loading it like below, it fails in the app:
GRAPHQL {{path}}
Authorization Bearer {{token}}
Content-Type: application/graphql
< ./query.graphql
with
Error executing GraphQL request! graphql.kickstart.servlet.InvocationInputParseException: Request parsing failed at graphql.kickstart.servlet.HttpRequestHandlerImpl.parseInvocationInput(HttpRequestHandlerImpl.java:72)
After digging a little bit more, it seems to be a difference in how the request is delivered to the endpoint. It looks like when providing query in the body - the request is packed in JSON, when loading request from a file - the request is sent as is
See difference:
// This works
POST /my-graphql/graphql, payload={"query": "query {\n total {\n amount\n currency\n }\n}"}
// This fails
POST /my-graphql/graphql, payload=query { total { amount currency } }
Looks like IntelliJ bug?
The second issue is that when I right click on a folder to run all requests, IntelliJ gives me option to run all tests - which is not what I want. Is it possible to create run configuration to execute all .http requests from multiple files?
It looks like neither of above is possible now:
Loading query from a file: bug reported here: https://youtrack.jetbrains.com/issue/IDEA-310914/IntelliJ-Http-client-and-GraphQL-request-fails-when-loading-query-from-a-file
Triggering multiple .http files simultaneously - not possible, feature voting here: https://youtrack.jetbrains.com/issue/IDEA-239323
Related
First off, I apologize if I use any incorrect terminology. I'm familiar with calling internal apis, but this a side project and new territory for me.
I've been using chrome debugger and powershell to write some scripts against the api of a public site. I was able to retrieve the JWT token, however after a few minutes my calls will start to fail with a 403 error. To get around this I've been exporting all the request headers from chrome and storing those locally for my script to pass whenever my call to the api fails. I narrowed it down to 4 headers that must be present, the one that is most suspect seems to be "cookie".
I then removed all key value pairs in the cookie header until I found the one that makes it fail. It's named "__cf_bm". A quick google says it's some kind of cloudflare bot management data. I don't see any of the data present in the __cf_bm cookie being sent in a response during authentication, I only see it in request headers. Is it not possible to construct this value? Does this essentially prevent me from interacting with the site's api?
I have some png files stored in Azure file Storage, and I'm retrieving and displaying it from my MVC web project to the browser. But sometimes I get the below error message from browser console.
Failed to load resource: the server responded with a status of 400
(Condition headers are not supported.)
If I refresh the page again, the error message disappears automatically. But it doesn't solve my problem as I run my MVC project again, the same error comes back. How to solve it?
It's acutally a common issue on Azure Storage, which be listed in the offical reference Common REST API Error Codes as the figure below.
It means that Get File REST API does not support those request headers which not be listed in the Request Headers.
There is a similar SO thread Azure File Storage Error: Condition Headers Are Not Supported, which got the same issue with yours. It seems to show up different behavior in different browses when you get a file from Azure File Storage.
I could not reproduce this issus by a file url with SAS token, but I really recommend that you need to store these static files like images on Azure Blob Storage, as I known and as Azure best practice, to show an image by its url with sas token or a public container.
I have a job in Jenkins that accepts a text file parameter.
Builds are triggered from an excel macro - and I'm having difficulty understanding how to send the file to Jenkins.
Up until now, what I understood is the following:
the file must be sent in an HTTP POST request, in the body.
the file must be sent in multipart/form-data format.
What I can't seem to manage to find out:
how exactly do I encode my file to multipart/form-data in VBA?
how do I send multiple files to Jenkins in the same HTTP POST request?
More information that might be helpful:
I'm using MSXML2.XMLHTTP60.
The job has other parameters (string, password), so I'm using the format:
http://server/job/myjob/buildWithParameters?PARAM1=Value1&PARAM2=Value2
Thank you in advance for any help.
EDIT:
After a lot of headeache, I discovered that currently, the option of sending a file parameter via an http POST request is not supported:
https://issues.jenkins-ci.org/browse/JENKINS-56169
But it has been opened as a new feature request.
The only option is pretending to be the web browser, and sending an http POST request identical to the one the Jenkins server is expecting to receive.
This poses the problem I described in the Jenkins Issue - the server's response doesn't contain the item's location in the queue.
I develop an AC/SpringBoot Jira plugin which needs to store properties in the host application. Atlassian provides Hosted Data Storage which I like to use.
I ran a test via Firefox RESTClient to play around with this feature.
When issuing a GET request to this URL:
https://kuespert-dev.atlassian.net/rest/atlassian-connect/1/addons/<MY-PLUGIN-KEY>
while being logged in to my Jira/Cloud instance on another tab everything is fine: I get back information about my plugin, including the key.
However, when issuing a PUT request to set a variable (like described in the documentation mentioned above) using this URL:
https://kuespert-dev.atlassian.net/rest/atlassian-connect/1/addons/<MY-PLUGIN-KEY>/properties/testProperty
and this request body:
{"string":"string-value","number":5}
as well as the required header:
Content-Type: application/json
I get back this response:
{
"status-code": 404,
"message": "Add-on with key does not exist."
}
This is a bit irritating, since the first REST call did find my plugin while the second to the sub-resource did not.
A similar question was already asked on the 'Atlassian Community' site, but no solution was found until today.
Maybe it's just a wrong error message or something similar. Does anybody here have experience with the 'Hosted Data Storage' feature and can help?
Thanks,
Matthias
I am trying to use JMeter to test our Web Application. We originally used LoadComplete to test our Web Application, but because LoadComplete is not able to run on a non-GUI mode, we were not able to use the max stat’s from our test server (strain our 8 CPU’s and 8GB’s of RAM). That is why I moving towards JMeter (https://blazemeter.com/blog/5-ways-launch-jmeter-test-without-using-jmeter-gui).
The test includes logging in, choosing a specific app, do a simple task through this app and then end the recording. The HTTP Requests, which are failing are printing Failed Access on their Response Data on the View Results Tree.
I used the HTTP(S) Test Script Recorder to record each HTTP request. My JMeter project is failing on a few different HTTP Requests, which includes oauthtoken Get Request that includes jessionid="item", a GET resourceLastAccessedTime Request, and a couple GET resourceLastAccessedTime Requests. I tried to follow blazementer's guidance for how to use JMeter for Login Authentication, because these requests seem to be involved with the authentication of each user after logging in and the problem I am getting on Response data for each of these requests on the View Results Tree it says Access denied. (https://docs.blazemeter.com/customer/portal/articles/1743663-how-to-use-jmeter-for-login-authentication-).
One of the steps is to "copy and paste" the Parameters from the Post request after you login to these requests. I can add these parameters to these requests right below where it says Send Parameters with the request, but our POST request only has two parameters (the login name and the password). Is there somewhere else to look for these parameters?
I tried a combination of a lot of different attempts, but I am still unsuccessful (meaning: I moved the Regular Expression Extractor to a few different HTTP requests and I moved which HTTP requests to put those parameters and I have not been successful yet).
Do you know of a URL that could be helpful for this?
Don't trust Test Script Recorder! It doesn't follow any logic while recording your requests. It just records requests processed through proxy as they are. In case you use parameters that can't be defined as constants, the best way would be to rewrite the script manually.
Be patient and spend some hours (only once!) to learn how to construct any test scenarios (even complex) manually using Jmeter GUI. It will save you a lot of time for debugging.
It seems like (just a guess) that your test scenario doesn't contain Cookie Manager item. Based on what you wrote above, it seems like after logging to serer (by sending POST with login and password) it sets some cookies by Set-Cookie HTTP header. These cookies should be included in every next request as a prove that you successfully logged in before (the most common logic for simple web applications). So, if you get Access Denied, means you didn't include appropriate cookies in test request. Use Cookie Manager for that.
Feel free to ping me in case you need any assistance.
Jmeter help manual is all you need to know about how each element works.
P.S.: Jmeter also can generate distributed load from multiple slave servers, in GUI and CLI modes both. So, in case you need to stress your server yout, Jmeter is the best choise.
And welcome to Jmeter users family! Good luck.