1,708 questions
0
votes
2
answers
2k
views
Mocking an HTTP error Observable in Jasmine and RxJS
This question is sort of a duplicate, but since I can't comment on other questions I've had to open a new one.
I'm running into a bug in a jasmine test where a function is supposed to handle an error ...
0
votes
0
answers
653
views
port 443: Connection refused in R on personal computer
I am following an API tutorial:
https://www.dataquest.io/blog/r-api-tutorial/
and step 1 - I attempted a GET request
res = GET("https://api.open-notify.org/astros.json")
I immediately hit a ...
1
vote
1
answer
173
views
Continue python script even if urllib.request encounters HTTP error codes
I have a python script that accepts a CSV file containing a list of URLs. The CSV file looks like this.
name, url
google, https://httpstat.us/200
yahoo, https://httpstat.us/401
bcs, https://httpstat....
2
votes
1
answer
80
views
Why isn't it recommended to use bare HTTP status codes in a response?
According to the documentation for Django REST Framework, "using bare status codes in your responses isn't recommended". They recommend instead using the objects from the status module (e.g. ...
0
votes
1
answer
39
views
Asynchronous API - POST & GET - multiple GET endpoints
I am building an Asynchronous API with polling and it has the following endpoints -
POST Create Resource
Request -
curl -X POST https://api.example.com/v1/card/eligibility/
Response -
{
"...
4
votes
3
answers
4k
views
Correct HTTP status code for a resource not found
For example, I need to find User resource with the following address api/user/1.
In this case i am looking for exact resource with ID 1 and if resource does not exist, then 404 should be returned.
But ...
0
votes
0
answers
61
views
Express response status 400 change to 503
I'm using Express, and I want to send response status code 400. The morgan says that I responsed with status 400, but I get 503 in browser.
router.get('/counselor/field', async (req, res, next) => {...
0
votes
1
answer
42
views
What is the appropiate http status code to give, when a user is using an unallowed authorization method?
For context, I am working on an API in postman, where an http request can be authorized using an api key or basic authentication.
I was using 401 as a status code if a different authorization method ...
0
votes
1
answer
100
views
If I add the "-f" parameter to CURL, how can I display the response body when the status code is not 200?
I am using curl to make a http request, and I need it to report an error(return not zero) when returning an abnormal status code, so I added the "-f" parameter. But this way, the content of ...
1
vote
1
answer
191
views
Why should I use Rails HTTP status symbols instead of codes? Or, why not?
E.g. :ok over 200 (or viceversa) for HTTP responses.
Advantages and disadvantages, pros and cons, etc. of using symbols instead of codes (or viceversa) are welcome.
0
votes
0
answers
30
views
GetResponse -- returns response.Status strings instead of HttpStatusCodes
I coded up a Restsharp call to Bitly's APIs and it worked. I received back the numbered HTTP StatusCode in the 200, 300, 400, and 500 ranges.
Now that switched over to using the BitlyAPI Nuget ...
0
votes
0
answers
927
views
C# Downloading files from Google Cloud and facing this error (HttpStatusCode is not found. Newtonsoft.Json.JsonReaderException)
I have been trying to upload and download files to and from google cloud .
public static class Program
{
public static void Main(string[] args)
{
...
1
vote
1
answer
6k
views
HTTP Status code for partial success or partial error response
I have an application where we send a request to two applications parallelly. Once I receive both the responses, I consolidate them to form a final response. When one of the systems fails to send a ...
0
votes
0
answers
2k
views
The type HttpStatus does not define isError(HttpStatusCode) defined here in java 17
I am trying to upgrade my existing code to java 17 , but I am getting an error while trying to return the bearer token response. The onStatus method is giving compilation error but it was working ...
2
votes
0
answers
11k
views
What could be causing "SSLError: EOF occurred in violation of protocol" when using requests.get() to access YouTube videos in python?
I am very new to programming and the computer world in general. I am trying to send a request to www.youtube.com using the requests module. When I type its address in my browser, everything works just ...
0
votes
2
answers
555
views
Which HTTP code is most suitable for when an endpoint is "full"?
If you have an endpoint that only a limited number of connections can be open to (think a video call, or a queue for a ticketing site), what's the best HTTP Code to signal to a Client that the ...
1
vote
1
answer
798
views
What would be the proper HTTP Status code when user exceeds daily transfer limit?
Each user has daily credit limit.
If user exceeds their daily limit what HTTP status code would be right here.
403 -Forbidden or 200 -Success (with validation Result)
2
votes
1
answer
2k
views
What would be the best-practice standard for backend response of an expired JWT token? [closed]
So what I found useful is according to MDN's HTTP Response Status Code the status code that can qualify is:
400 Bad Request
401 Unauthorized
406 Not Acceptable
412 Precondition Failed
Now, I was ...
1
vote
1
answer
233
views
Why is the client receiving a different status_code than the sent one?
I have this endpoint in my API which calls another endpoint in another API. I'm just returning the received response to the client, but sometimes the client is actually receiving a different ...
1
vote
1
answer
1k
views
Is HTTP status 202 appropriate for account creation, while waiting for a confirmation code?
I have an API with a 2 step sign-up flow:
user requests a new account (POST with some account information in the body)
user confirms the account (POST with a verification code received via text or ...
1
vote
1
answer
974
views
Powershell webrequest handle response code and exit
I want it to exit when the response status code is 429, how can I do it? my looped ps1 script
I don't want to use do or try or catch methods. Is there a simple method? this is my code and i want it to ...
-3
votes
1
answer
1k
views
What is the correct error code for timeout?
I am developing a website and it will display a page for 5 minutes and user will be redirected to an error page which ask them to refresh the page. What status code should I put in the error page?
I ...
0
votes
1
answer
43
views
Which status code to use after deep pagination limit
We have an API and we want to reject requests beyond page 99.
EG:
GET example.com/users?page[number]=99 # Allowed, returns 200 OK
GET example.com/users?page[number]=100 # Disallowed, returns ???
What ...
2
votes
1
answer
2k
views
What is the correct status code, if my server can't reach a third party server? [duplicate]
I have a server, which does a request to AWS S3.
What is the correct status code, if my server's request to S3 failed?
Let me break it down more.
"Client" does request to "my server&...
0
votes
1
answer
953
views
Is there a way to override or change php/laravel request validate status code?
As you all may know, when we use laravel validate() function, the error status code it throws is 422. Is there a way to override or change the status code to 400?
$request->validate([ 'title' => ...
-1
votes
1
answer
55
views
http API Calling handle status code common function
Just cast it to
override fun httpErrorHandle(e: Throwable) {
val error = e as ANError
errorMessage(activity!!, error)
}
1
vote
1
answer
98
views
Does incorrectly returning an HTTP status code break the protocol?
For instance, if a request failed due to no authorization, clients expect a 401. However, if a server returns a 200 but with a message indicating failure to authenticate, does this technically go ...
1
vote
1
answer
178
views
Which HTTP response code does a Rails controller return for a given class of unhandled exception?
Two-part Rails question:
Part 1
When a Rails controller raises an unhandled exception, an HTTP 500 (Internal Server Error) status code is typically returned in the response to the caller.
However, I'...
0
votes
2
answers
309
views
Http Status Code. To identify wrong password or wrong username
If return 401 (Unauthorized), I don't know password field is wrong or username is wrong in frontend.
Which code should return for password wrong? and which code for username wrong?
I wanna know ...
0
votes
1
answer
158
views
ASP.NET Core Web API return status code + object
For ASP.NET Core 6.0 Web API :
What is the best practice on returning an async result that contains a compound result :
JSON representation of object/collection ( T or IEnumerable )
HttpStatusCode
0
votes
1
answer
81
views
Need to do validation so if the url is invalid, then only send the email
I've create a script which checks a list of urls, and if their http status code is 200 then the urls are up and if their http status code is anything other than 200 then they are down.
I've also setup ...
1
vote
0
answers
160
views
nodemailer is sending email for each invalid url
I have created a script in node js which basically fetch some urls and get their http status codes. If the http status code are not equal to 200 and I want to send mail using nodemailer. (In the email ...
1
vote
1
answer
76
views
Errorhandling in post
I am currently writing a NET 6 web API. I have to implement a method which saves a list of items. I wrote the following POST-Method to do that:
[HttpPost]
public IActionResult PostCustomer(List<...
2
votes
1
answer
677
views
How to initialize CoreWCF.OperationContext in unit tests?
I have a CoreWCF .NET 6 service that returns custom HTTP status codes with this code:
var requestProp = new HttpResponseMessageProperty(); OperationContext.Current.OutgoingMessageProperties[...
0
votes
1
answer
77
views
How to configure Https in .net core to send status code description
When using app.UseHttpsRedirection(); in startup.cs and https link,
The Response doesn't contain status code description
Error status code when using https image
but when app.UseHttpsRedirection(); ...
-1
votes
1
answer
323
views
400 Bad Request Error while login into app [duplicate]
I am running automation script using WebdriverIO and the test case is,
pseudo code:
Description("Pay the due payment to the vendor user", async () => {
it("Pay using CC", async ...
0
votes
1
answer
45
views
Method returns HttpStatusCode in angular
I want to make a method that only makes another request when the before request return StatusCode 200. I'm using angular 15.
My home.component.ts look like this and I want to todasGuias() only make ...
2
votes
1
answer
5k
views
How to modify response status and body after committed spring boot
I implemented a rate limiter with Filter.class. However, we encountered that we should not limit successful requests. So, I needed status code of the response. When I get status code in Filter chain, ...
1
vote
3
answers
3k
views
PUT vs POST - correct response code if already completed
Currently developing a REST API, with a suite of endpoint functions which update the "state" of a particular resource.
I am using POST to create the initial resource and then updating the ...
3
votes
0
answers
1k
views
RestSharp GetAsync throws an Exception instead of returning BadResult
I'm getting an exception instead of a HttpStatusCode.BadResult when I use GetAsync RestSharp method.
Request failed with status code BadRequest
Let me say that Postman and Swagger return the proper ...
0
votes
1
answer
4k
views
How to get the status code from an http method created on a Provider in Flutter
I'm trying to modify the text from an Alert in a screen based on the status code of an http method, but I created the http method on another archive, which has a class with provider (changenotifier), ...
0
votes
1
answer
107
views
Get Thumbnail from FORGE API but received status code 202
I'm trying to get thumbnail from Forge API here
https://forge.autodesk.com/en/docs/model-derivative/v2/reference/http/thumbnails/urn-thumbnail-GET/
`
I got it with Postman and axios successfully, ...
1
vote
1
answer
276
views
Javalin hangs when asked to give 1XX HTTP status
I have a Javalin server, the relevant code called by the endpoint looks like this:
...
if(!someFuture.isDone()){
ctx.status(102);
return;
}
Javalin hangs and does not return anything* when ...
1
vote
0
answers
181
views
Using Powershell to "Discover" devices with a Web interface
I am trying to develop a PowerShell tool to gather "Discovery" information about devices on our network. We already have a commercial discovery tool but in quite a lot of cases, it is not ...
0
votes
1
answer
198
views
Is there a way to configure a default 5xx error message in a rails app?
I’m new to Ruby/Rails and working on my team’s web app. I am wondering if there is a way to configure the app so that any 5xx http status error will give the client the same generic error message (in ...
0
votes
1
answer
58
views
How to see status of request in angular?
I return the context and status code from Django rest API as follows
Admin.objects.get(email_id = request.data.get('email_id'), password = request.data.get('password'))
context = {'resp' : ...
0
votes
0
answers
281
views
Need help understanding Python Fast API requests and how to change them?
I am following this tutorial here: https://dev.to/nditah/develop-a-simple-python-fastapi-todo-app-in-1-minute-8dg
Most of the requests return a 303 status:
@app.post("/add")
def add(req: ...
1
vote
1
answer
1k
views
Customise htaccess Expires header setting for cache control for home, category URLs
I am using following code in .htaccess to set Expires header status in WordPress site and its working fine.
## EXPIRES HEADER CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
...
1
vote
2
answers
279
views
Differentiating between 404 types
I know the 404 vs 204 debate has been beaten to death, and I understand the argument for using 404 when there is no record in the table corresponding to a REST endpoint request, but it feels like ...
2
votes
2
answers
3k
views
Express server Error 400 is not returning json message
I am submitting a form and if the form id already exists in the database, I am returning status 400 with a message saying that the form exists.
res.status(400).send({
status: 400,
message: "...