Test via Rest Assured returns 404 instead of 200 - rest-assured

While validating a call using Postman and WireShark I can see a success response with status code 200 but when I try using Rest Assured I am getting a 404 error code
Below is the error

Related

Rest Assured - 404 when accessing localhost but accessible using Postman and browser

enter image description hereenter image description hereI get 404 when testing a GET api using Rest Assured on localhost developed using Spring boot Data JPA. However, On clicking the request url from Rest Assured logs it opens in browser.
The request works fine on Postman as well. However, cUrl code generated by Postman throws same error.
For Post request I get 403, Forbidden error in RA. works fine in Postman.

Getting error code 200 for google assistant on Raspberry pi 3

I am getting the following errors:
https://embeddedassistant.googleapis.com/v1alpha2/projects/rpiassistant-f01c3/devices/B65EF05D34859770BDEBF646E84D89F1 200
ON_MUTED_CHANGED:
{'is_muted': False}
ON_START_FINISHED
[2509:2526:ERROR:http_client_with_backoff.cc(113)] Retrying request with http_status=200 request_id=0
The above URL returned as follows:
{
"error": {
"code": 403,
"message": "The request is missing a valid API key.",
"status": "PERMISSION_DENIED"
}
}
Please note that I have enabled the API still getting this error please help
HTTP status code 200 is not an error. Rather, it is an indication that the HTTP request was successful.
When the sample is making that call, it includes authorization that tells the Google Assistant SDK server that it is you making this request. When you just open it up in a browser, the server doesn't know it is you and returns a 403 for unauthorized access.
AFAIK, this is working as intended and you should be able to run the sample without issue.

Getting HTTP 408 Request Timeout when submitting a POST request from Jenkins but the same is working fine using Postman

I'm calling an api (new relic insights api) and therefore using a HTTPs POST request (alongwith the required header) to call the api and run a NRQL query. Now, this POST request is working fine with Postman (or any other online tool for submitting https post request and I am getting the expected response as well, but when I try doing the same using HTTP Request Plugin in jenkins I am getting exceptions and errors as follows:-
class org.apache.http.conn.HttpHostConnectException(Connect to
insights-api.newrelic.com:443
[insights-api.newrelic.com/50.31.164.169,
insights-api.newrelic.com/50.31.164.210,
insights-api.newrelic.com/50.31.164.207,
insights-api.newrelic.com/50.31.164.208,
insights-api.newrelic.com/50.31.164.209] failed: Connection timed out:
connect) as 408 Request Timeout
The POST request is as follows:-
https://insights-api.newrelic.com/v1/accounts/******/query?nrql=SELECT%20count%28aonOperationNm%29%2C%20sum%28duration%29%2C%20average%28duration%29%2C%20min%28duration%29%2C%20max%28duration%29%2C%20percentile%28duration%2C%2090%29%2C%20percentile%28duration%2C%2095%29%2C%20percentile%28duration%2C%2099%29%20FROM%20Transaction%20WHERE%20appName%3D%20%27******%27%20FACET%20**************%20SINCE%20%272017-07-06%2007%3A33%3A00%20CDT%27%20UNTIL%20%272017-07-06%2008%3A07%3A00%20CDT%27%20limit%201000
and the associated header that I need to pass is:-
*X-Query-Key* - ***************************
(data masked with ******)
I'm able to get response for this using postman but not with jenkins. Also, the machine I'm trying connects to the internet via a corporate proxy which has been already configured in jenkins (Manage plugins - advanced), still getting http 408 error. What could I be missing?
Thanks in advance!
What happens when you issue a GET instead of a POST?
This Insights API example provided here via the New Relic docs uses a GET:
curl -H "Accept: application/json" -H "X-Query-Key: YOUR_QUERY_KEY" "https://insights-api.newrelic.com/v1/accounts/YOUR_ACCOUNT_ID/query?nrql=SELECT+count%28appName%29+FROM+PageView+SINCE+%272014-08-04+00%3A00%3A00%2B0500%27"

Get HTTP Status-Line in Alamofire

I am using the Alamofire 4.0.1 library in swift 3; I am looking for the HTTP Status-Line (as described in https://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html). I can get the status code, the headers, everything, but not the status message.
I am querying a REST API which gives me 403 responses with different messages after the "Forbidden" keyword describing the problem: like the client is not approved for access or that accessing an specific URL is not allowed, because it is for internal use only. In my client accessing the API I want to give the user more details than just the "Forbidden" message.
This is what the server sends back (I know this because I used Paw, a HTTP Client to send a HTTP request and investigate the response):
HTTP/1.0 403 Forbidden (internal method)
So to conclude, is there any chance to get the HTTP Status-Line in Alamofire?
Unfortunately no
Alamofire uses the URLResponse and it does not implement any field/method that gives you information about Status-Line. To get the Status-Line you should use other maybe lower-level frameworks.
URLResponse gives you only information about allHeaderFields, you can look on my answer about it here :
https://stackoverflow.com/a/36524454/5433235

Why isn't connection didFailWithError not called?

I am sending a request to my server, and receiving a status code of 500
Why instead of calling connectionDidFailWithError the system is calling connectionDidFinishLoading
both methods have implementations in my class delegate
HTTP status code errors are not considered connection errors. If you get a 500, the HTTP connection did not encounter any error. It received a legitimate response: a 500 status code. didFailWithError: is for things like a "connection refused" error. You can find a comprehensive list of NSURLErrorDomain and CFNetworkErrors errors here.
According to this blog post, NSURLConnection class was originally written for the first release of Safari in 2003 and the original goals for NSURLConnection still show in its API design:
A web browser does not need to distinguish between HTTP status codes.
Regardless whether the response’s status code is 200, 404 or 500, the
browser can always get away with displaying the response body.
Consequently, NSURLConnection reports a 404 response as success. In
contrast, a web service client needs to handle a 4xx or 5xx response
as an error.

Resources