Http Status Code in Android Volley when error.networkResponse is null

Or, how can I ensure error.networkResponse is non-null in onErrorResponse? My first thought would be to check if the object is null. @Override public void onErrorResponse(VolleyError error) { NetworkResponse networkResponse = error.networkResponse; if (networkResponse != null && networkResponse.statusCode == HttpStatus.SC_UNAUTHORIZED) { // HTTP Status Code: 401 Unauthorized } } Alternatively, you could also try grabbing … Read more

Get status code http.get response angular2

Adding answer for versions of Angular >= 4.3 (including 15) with new HttpClient that replaces http import {HttpClientModule} from ‘@angular/common/http’; // Notice it is imported from @angular/common/http instead of @angular/http How to get response code or any other header: http.get( `${this.baseUrl}users/activate?mailToken=${mailToken}`, {observe: ‘response’} ) .subscribe(response => { // You can access status: console.log(response.status); // Or … Read more

Is it OK to return a HTTP 401 for a non existent resource instead of 404 to prevent information disclosure?

Actually, the W3C recommends (RFC 2616 §10.4.4 403 Forbidden) doing the opposite. If someone attempts to access a resource, but is not properly authenticated, return 404 then, rather than 403 (Forbidden). This still solves the information disclosure issue. If the server does not wish to make this information available to the client, the status code … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)