Giter Club home page Giter Club logo

Comments (6)

ahmadSaeedGoda avatar ahmadSaeedGoda commented on May 20, 2024

any updates here guys?

Please help!

@kevmoo @michalt @cdibona @dberlin

from sync_http.dart.

kevmoo avatar kevmoo commented on May 20, 2024

There's no reproduction steps. No details. No idea how we can help...

from sync_http.dart.

ahmadSaeedGoda avatar ahmadSaeedGoda commented on May 20, 2024

@kevmoo Well, I believe there's no details and/or steps to reproduce the issue because of absence of a template to be filled out whenever someone tries to file a new issue!

I think It was supposed/expected for the issue creator to be guided to create an issue for this repository via a template placeholder that was supposed to exist and being put by the maintainers inside the box of a new issue body.

Since there's lack of guidance (Yet in my POV), even inside the Contributing Guidelines and the Code of Conduct that are being mentioned below this page "as well as in the About Section at the repository's home page", and since there's nothing that relates to creating or reporting an issue even at an external place while being referenced here by this repo, Therefore, I think I have to guess and assume on my own in order to make it more clear for you.
And hopefully this will make sense for you eventually, Otherwise, Kindly let me know how can I meet the expectations.

Hence I am going to use the following template:

Steps to reproduce

  1. Create a client code that uses this lib. e.g
import 'sync_http.dart';

void main() {
  var uri = Uri.parse('https://dog.ceo/api/breeds/image/random');
  var request = SyncHttpClient.getUrl(uri);
  var response = request.close();
  print('Response Status Code: ${response.statusCode}');
  print('Response Body: ${response.body}');
}
  1. Run the code.

Current behaviour (bug)

Response Status Code: 400
Response Body: <html>
<head><title>400 The plain HTTP request was sent to HTTPS port</title></head>
<body>
<center><h1>400 Bad Request</h1></center>
<center>The plain HTTP request was sent to HTTPS port</center>
<hr><center>cloudflare</center>
</body>
</html>

Expected behaviour (correct)

Response Status Code: 200
Response Body: {"message":"https:\/\/images.dog.ceo\/breeds\/whippet\/n02091134_7375.jpg","status":"success"}

Relevant logs and/or media

Screenshot from 2022-03-01 22-58-18

Other comment

  • Dart SDK Version (dart --version): Dart SDK version: 2.16.1 (stable) (Tue Feb 8 12:02:33 2022 +0100) on "linux_x64".
  • Operating System is Linux UBUNTU.
  • lib sync_http version: 0.3.1-dev "From pubspec.yaml".
  • Related issue: Here

Reported by

@ahmadSaeedGoda && @alaashahin1

/label ~Bug

Hope you find this useful.
In addition, if I can provide any further information let me know, would be more than happy to assist!

from sync_http.dart.

saurabhgoyal12 avatar saurabhgoyal12 commented on May 20, 2024

I am facing the same issue. Did you find a solution for this?

@kevmoo Well, I believe there's no details and/or steps to reproduce the issue because of absence of a template to be filled out whenever someone tries to file a new issue!

I think It was supposed/expected for the issue creator to be guided to create an issue for this repository via a template placeholder that was supposed to exist and being put by the maintainers inside the box of a new issue body.

Since there's lack of guidance (Yet in my POV), even inside the Contributing Guidelines and the Code of Conduct that are being mentioned below this page "as well as in the About Section at the repository's home page", and since there's nothing that relates to creating or reporting an issue even at an external place while being referenced here by this repo, Therefore, I think I have to guess and assume on my own in order to make it more clear for you. And hopefully this will make sense for you eventually, Otherwise, Kindly let me know how can I meet the expectations.

Hence I am going to use the following template:

Steps to reproduce

  1. Create a client code that uses this lib. e.g
import 'sync_http.dart';

void main() {
  var uri = Uri.parse('https://dog.ceo/api/breeds/image/random');
  var request = SyncHttpClient.getUrl(uri);
  var response = request.close();
  print('Response Status Code: ${response.statusCode}');
  print('Response Body: ${response.body}');
}
  1. Run the code.

Current behaviour (bug)

Response Status Code: 400
Response Body: <html>
<head><title>400 The plain HTTP request was sent to HTTPS port</title></head>
<body>
<center><h1>400 Bad Request</h1></center>
<center>The plain HTTP request was sent to HTTPS port</center>
<hr><center>cloudflare</center>
</body>
</html>

Expected behaviour (correct)

Response Status Code: 200
Response Body: {"message":"https:\/\/images.dog.ceo\/breeds\/whippet\/n02091134_7375.jpg","status":"success"}

Relevant logs and/or media

Screenshot from 2022-03-01 22-58-18

Other comment

  • Dart SDK Version (dart --version): Dart SDK version: 2.16.1 (stable) (Tue Feb 8 12:02:33 2022 +0100) on "linux_x64".
  • Operating System is Linux UBUNTU.
  • lib sync_http version: 0.3.1-dev "From pubspec.yaml".
  • Related issue: Here

Reported by

@ahmadSaeedGoda && @alaashahin1

/label ~Bug

Hope you find this useful. In addition, if I can provide any further information let me know, would be more than happy to assist!

I am facing same issue. Did you find a solution to make sync call ?

from sync_http.dart.

chinabrant avatar chinabrant commented on May 20, 2024

I am facing same issue. @kevmoo @ahmadSaeedGoda @alaashahin1 @saurabhgoyal12 @michalt

from sync_http.dart.

meatlover avatar meatlover commented on May 20, 2024

Apparently all HTTPS requests would fail. Client sents request as plain http even if specified https:// in url. It is not a matter of localhost or remote.

To whoever looking for a synchonous http call solution, I end up using dart:io with async/await. Below is an example I figured out that works.

import 'dart:io';
import 'dart:convert';
...
var request = await HttpClient().postUrl(url);
request.headers.set('Content-Type', 'application/json');
request.write(body);
var response = await request.close();
if (response.statusCode == 200) {
final responseBody = await response.transform(utf8.decoder).join();
// actions here
}

from sync_http.dart.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.