Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

113
Views
Node.js no detecta cuando el cliente Swift envía una solicitud GET

mi código en el lado del cliente se ve así:

 func getRequest() { let server = appState.server + "endpoint" let package = CustomObject(param1: val1, param2: val2) guard let url = URL(string: server) else { return } var urlRequest = URLRequest(url: url) urlRequest.addValue("application/json", forHTTPHeaderField: "Content-Type") urlRequest.addValue("application/json", forHTTPHeaderField: "Accept") urlRequest.httpMethod = "GET" guard let data = try? JSONEncoder().encode(package) else { return } urlRequest.httpBody = data let task = URLSession.shared.dataTask(with: urlRequest) { (data, response, error) in if let error = error { return } guard let data = data else { return } guard let dataString = String(data: data, encoding: String.Encoding.utf8) else { return } let jsonData = Data(dataString.utf8) DispatchQueue.main.async { print("dataString is found and it's \(dataString)") } } task.resume() }

En el lado del servidor:

 app.get('/endpoint', function (request, response) { console.log("THIS SHOULD PRINT") //do stuff with request.body start() response.send('GET request to the homepage') })

Por alguna razón, no se alcanza el punto final GET, por lo que no se imprime nada. No estoy seguro de lo que me estoy perdiendo en la configuración del lado del cliente.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!