Questions tagged [http]

36576 questions
1

votes
1

answer
710

Views

WebSocket Server (Java) cannot read but send to C# (Unity) Client

For a project in university we should build a multiplayer game. Cause I have quiet a lot experience in Unity I want to use it as Game Engine. We have to use WebSockets for communication and json as protocoll to carry the data. So far so good. C# don´t have a default websocket implementation, so I u...
Snubs
1

votes
1

answer
1.1k

Views

How to broadcast HTTP request?

I'm designing a data acquisition system with sensor nodes that communicate with a server using HTTP, in Mono/C#. I'm using basic HttpWebRequest and HttpListener to implement the communication. The server will have an app with a Search button to find and display nodes present in LAN. Basically the no...
Cristian M
1

votes
1

answer
390

Views

Setting HTTP Header Fields for AVURLAssets

I'm attempting to load a video file that requires a token in the header. I learned on Stackverflow that this may be possible from looking at the following question. The problem is that I don't believe AVURLAssetHTTPHeaderFieldsKey is public or I have written my asset variable incorrectly. What I'...
Cosmic Arrows
1

votes
1

answer
429

Views

Fetch : status 302 in Edge 17

I'm using js fetch API to retreive datas from JSON. It's working fine (even in IE 11), except in Edge 17 i get 302, the response header are : Content-length : 0 Content-type: text/plain; charset=utf-8 Location: http://local.mysite.com/xxx My local website is on a Mac, i'm using BrowserSync to make i...
Julien CHAZAL
1

votes
1

answer
196

Views

HttpHeaders getFirst() case insensitivity

I'm fetching HTTP headers with Spring's RestTemplate. HTTP headers are case insensitive, but the documentation for HttpHeaders doesn't seem to acknowledge this. A quick test shows that things are working as expected... HttpHeaders headers = restTemplate.headForHeaders(url); Long a = Long.parseLong(...
nobar
1

votes
2

answer
44

Views

Handling 404 Errors in PowerShell

I have a huge list of blog URLs that I need to check the validity of. I've knocked together a script from this answer and from here. Here is my script: $siteURL = 'http://example.com/' $File = '.\urls.txt' $NewContent = Get-Content -Path $File | ForEach-Object { $_ $HTTP_Request = [System.Net.We...
Burgi
1

votes
3

answer
74

Views

Executing N times a Scala Future

I am trying to find a more elegant way to execute 2 times a function which returns a Future[HttpReponse] and then to use the response of the 2-end call. for { // function post returns a Future[HttpResponse] response
Martin
1

votes
3

answer
41

Views

Status code for “resource will never be available in this case”

I have a REST API dealing with invoices. Now each invoice has a special 'fee list' after it gets financed. Although not all are meant to be financed. I have an endpoint which provides information about this fee list for each invoice. So if an invoice has been financed, it returns 200, if invoice has...
1

votes
2

answer
64

Views

Angular RxJs level up during looping an array

I have an http get request to get an array like [ {name: 'name1', id: 1, specialProp: [] }, {name: 'name2', id: 2, specialProp: [] } ] I need to get each of array items, take an id and send a request to server to get some information. The results should be written into the property specialProp. Afte...
Vika
1

votes
3

answer
79

Views

Conditional Rendering on Server Side

Background I am using next.js for server side rendering and react.js for client side. Goal Want to do conditional rendering on the basis of window size in server side. Like for 200px width render A component and for 400px width render B component. Problem In server side, we have no access to the win...
1

votes
1

answer
320

Views

Http Client Angular 6

I'm trying to type the return of my request however I'm getting the following error: Type 'Observable' is not assignable to type 'Observable'. Type 'ArrayBuffer' is missing the following properties from type 'AccountModel[]': length, pop, push, concat, and 25 more I request is as follows: getAccount...
Guilherme Nunes
1

votes
1

answer
24

Views

Error processing http request on raspberry server

I have set up a raspberry webserver running on my school lan network ,other people are connecting with arduino,sometimes when they connect i get this error: Exception happened during processing of request from ('172.17.17.66', 49153) Traceback (most recent call last): File '/usr/lib/pythonz.7/Sock...
Matteo Crosilla
1

votes
2

answer
32

Views

OAuth token Unauthorized on browser

I'm using Angular 7 and I got a problem with Headers. This is my code: signin() { let signinData = this.signinForm.value; this.encoded = btoa('my-trusted-client:secret'); let header = new Headers(); header.append('Authorization', 'Basic ' + this.encoded); header.append('Content-type', 'application/x...
Ragnar Lodbrok
1

votes
1

answer
58

Views

How to pass data with GET request?

I want to pass form data with GET request. I have success with this curl: curl http://sample.com -d 'action=login_request&user_name=balvan' but I need to pass that same stuff from -d. with this function call: (http-client/request {:url base-url :method :get :deadlock-guard? fals...
Self Smarted
1

votes
2

answer
57

Views

How To Know All Asynchronous HTTP Calls are Completed

I am trying to figure out how to determine if all async HTTP GET requests I've made have completed, so that I can execute another method. For context, I have something similar to the code below: public void init() throws IOException { Map mapOfObjects = new HashMap(); ObjectMapper mapper = new Objec...
Pr0pagate
0

votes
1

answer
50

Views

Redirecting from https to http?

Strange problem here. I use FullCalendar to initiate an ajax request to an endpoint on my server. Endpoint is: https://my_website/events/?start=2019-03-31&end=2019-05-12&_=1555698739056 Note that it is explicitly https. However, when I initiate a request (that is, when Fullcalendar initiates a requ...
WillardSolutions
2

votes
0

answer
20

Views

How to fix 'http: named cookie not present' in golang?

I'm building a small dinner/plan management application (with the use of microservices) for a couple of people I know. The intention is that each person can login to their own account and can then authenticate to other services using a bearer token (JWT). This bearer token is stored in a cookie. How...
Abe Brandsma
1

votes
1

answer
60

Views

How to expose a web server with REST API and HTML/JavaScript applications from an existing Python application?

I have an existing Python application that crawls the Internet continuously. It uses the requests package to make HTTP requests to various Internet websites such as GitHub, Twitter, etc. and downloads the available data on to a filesystem. It also makes HTTP requests to the REST APIs of GitHub repos...
Lone Learner
0

votes
0

answer
5

Views

Plugin for authorization in header for wordpress api

I am creating WordPress api and i am getting error in my server { 'code': 'rest_cannot_create', 'message': 'Sorry, you are not allowed to create posts as this user.', 'data': { 'status': 401 } } but in my local machine its working fine . which plugin is used for authentication in WordPress api? i ha...
Emmie Andrew
1

votes
1

answer
6k

Views

http 1.0 keep-alive server and curl

I'm busy with my own http server implementation on an embedded platform. Technically the server is HTTP 1.0 compliant, and therefore it expects the the client to send the header 'Connection: Keep-Alive' to keep the connection open. The implementation looks like this. I removed the code that parses t...
user1964644
1

votes
3

answer
603

Views

Is it a good restful URL design to avoid using DELETE and PUT?

I read an example of restful service, it only uses two HTTP method: get post. for example, there is a task list at the server. To design the restful URL, we can use: www.example.com/task GET. return all the task list. www.example.com/task/id GET. return the specific task. www.example.com/task/c...
Jimmy
1

votes
2

answer
2.4k

Views

HTTP status code for invalid format

Our system is accepting a text file upload and is supposed to have a pre-determined line count. If the line count doesn't match up, I want to send a warning of sorts back to the user asking to confirm that they want to upload anyway. Is there a particular status code I can use for something like thi...
kenshin9
1

votes
1

answer
679

Views

how to force space to %20 in http_build_query?

I am facing a problem, that the API endpoint expects one of parameters with %20 replacing one of the spaces. Example: $params = array( 'client_id' => self::$client_id, 'scope' => 'api%20offline_access', //here I need the %20 sign 'response_type' => 'code', 'redirect_uri' => self::$redirect_uri ); If...
Pavel Janicek
1

votes
2

answer
483

Views

Sending HTTP Post request from node to Foxx service (ArangoDB)

I am trying to send a post request from a node + express server to my Foxx service on Arangodb. On the node side : var route = arangopi + '/edge/' + col.name ; var body = {data: data, from: fromId, to: toId} ; console.log('|| body :', route, body) ; >> || body : http//XXX/_db/my-DB/my-foxx-service/...
user6403833
0

votes
1

answer
15

Views

I can't get my “event.preventDefault” to work when submitting a form through button in overlay

As the title says, I can't get my event.preventDefault to work on a submit POST request of my form. Using standard js, flask, css, and html. ASFAIK there are no errors anywhere. If I can just have the overlay stay where it is and still send the post back to flask that would help me a tons!! Thank y...
tinnick
0

votes
0

answer
15

Views

How to fix bad request (code 400) error in post request?

I am adding an Agreement Module in my app, where in the user will tap the checkbox when he/she agrees. When the user tapped the checkbox it will return a true value and will enable the proceed button. Upon tapping the proceed button it will activate the user's account. The problem is, it returns a...
Titus
0

votes
0

answer
9

Views

Why is TLS relevant in non-secure http?

I am using WebClient to get data from a web resource thus: var wc = new System.Net.WebClient(); var stream = wc.OpenRead('http://...'); // etc.. It used to work until recently, when the server would forcibly close the connection. Based on this StackOverflow answer, I added the ServicePointManager se...
Zenilogix
1

votes
3

answer
621

Views

Get response status code in a middleware

I am building an app in which I am trying to build my own logging system for each request. For each request, I'd like to log the timestamp, the method used, the route, and finally the response code that has been sent to the client. I have the following code for the moment : // index.js const expres...
nook
1

votes
1

answer
145

Views

How to add 404 error page in ruby on rails app?

Can you help me in this. I want to add 404 error page to my website. I tried many ways but nothing works for me. Here is one of them. ApplicationController unless ActionController::Base.consider_all_requests_local rescue_from Exception, :with => :render_404 end private def render_404 render :templa...
nourza
1

votes
2

answer
45

Views

Getting 400 Bad Request despite catching the err in angular2+

I have designed a login page where login is successful when i put a correct login and password and Login doesn't happen when I put an incorrect username or password which is correct. However, I get this error: POST http://localhost:3003/login/authenticate 400 (Bad Request) ERROR HttpErrorResponse {...
Techdive
1

votes
2

answer
156

Views

How to use invoke http to perform GET request in nifi?

I need to perform a get request from nifi to couchbase. The curl command is: curl http://HOST:PORT/query/service -d 'statement=select item.Date from bucket unnest bucket as item' -u USER:PASSWORD I tried using InvokeHttp and ExecuteStreamCommand but it keeps returning errors(status code 400). The fu...
Gal Itzhak
1

votes
1

answer
82

Views

Status 419 on laravel project with Load Balancer

I'm using Digital Ocean Load balancer to divide all the requests into 2 separated servers. Both servers are runing the same Laravel application, but when those 2 servers are online and i try to do a post request, sometimes i receive a status 419 and sometimes 200, but when 1 server is offline, the r...
Bernardo Kowacic
1

votes
2

answer
111

Views

How to send content with TIdHttp GET request?

I am trying to access a REST server that has an endpoint that uses the GET verb while it also requires json data to be sent in the body I am trying to accomplish that with an TIdHttp class, using the Get method. Right now I create a TStringStream with the json data, and then assign that stream to th...
R. Beiboer
1

votes
3

answer
51

Views

Django: handler403 doesn't work, but 404 does

Here is content of MyProj/urls.py: from django.contrib import admin from django.urls import path, include urlpatterns = [ path('admin/', admin.site.urls), path('', include('general.urls')), # Main app ] handler403 = 'general.views.handler403' handler404 = 'general.views.handler403' As you can see, b...
AivanF.
1

votes
1

answer
59

Views

How to speed up a http c server on larger payload?

I have a http c server I got from https://rosettacode.org. I tried to test it for typical web page sizes on text payloads of 1MB to 3MB. However, it seems that as payload increases, the server performance decreases in terms of the maximum possible request/s it can handle. What I am expecting is that...
James Guana
1

votes
3

answer
37

Views

AngularJs - Array.push() inside $http.get() produces a flawed array

I can't figure out what is wrong with my code. It seems to be a javascript issue. I'm loading a local txt file using $http.get (is there a different way?). I want to push this content into an array. For the sake of testing, I'm just pushing any string just to be sure that it doesn't have to do with...
Sergio
1

votes
1

answer
27

Views

TCP Socket HTTP GET Request Content-Length > 0 but not returning actual Content

I am trying to query a REST API service hosted on a Tomcat/Spring Boot application using a TCP Socket instead of an HTTPClient as I cannot use an HTTPClient. I am able to successfully open the Socket, send the request, and receive data from the server but there is never any body or content returned...
mhmmx
1

votes
1

answer
56

Views

Golang *bytes.Buffer nil causes fatal error [closed]

I had the same issue as https://github.com/golang/go/issues/26666 because I have a wrap function for my http requests. Sometimes I need to request: body := new(bytes.Buffer) json.NewEncoder(body).Encode(h) req('POST', 'http://example.com', body) And sometimes it's simply: req('GET', 'http://example...
Raimonds Linde
1

votes
1

answer
40

Views

Should Rest API return only structured data? What if I have to get html?

I'm trying to develop a super simple web page with REST API. In most examples, they suggest to get a resource like below. request GET /dogs/1 response HTTP/1.1 200 OK Content-Type: application/json { 'id' : 1, 'name' : bity } The path /dogs/1 represents structured data of dog 1. Then which path shou...
dain.lee
1

votes
1

answer
34

Views

Is it possible to combine 2 http responses into one in Angular?

I have Angular 6 app and external service api that returns maximum 50 records per request. But in some cases I need to get 100 records. For example the following request will give me first 50 records: www.example.com/records/?count=50 The following next 50: www.example.com/records/?count=50&lastID=F...
Arkadi

View additional questions