1

I'm trying to get an api from www.mocky.io, the issue is, when the app starts I'm getting an error like

E/flutter ( 846): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: HandshakeException: Handshake error in client (OS Error: E/flutter ( 846): CERTIFICATE_VERIFY_FAILED: unable to get local issuer certificate(handshake.cc:354))

this is how I'm getting the response.

 Future _fetchPost() async { http.Response response = await http.get(url); print(response.body); setState(() { var convertDatatoJson = json.decode(response.body); debugPrint(convertDatatoJson.toString()); _data = convertDatatoJson['table_menu_list']; });} 

How can I verify the certificate for this api link for GET method?

I referred this issue, for POST method https://stackoverflow.com/a/54359013/11893608,

any other suggestions would be helpful

2 Answers 2

1

Change https to http

it will Resolve your Issue

Use this : http://www.mocky.io/v2/5dfccffc310000efc8d2c1ad

Sign up to request clarification or add additional context in comments.

4 Comments

there is no https
paste the API here
i tried already and I'm getting the response, but why I couldn't get the response in https.upvoted();
1

Try adding both http and www.

Example:

http://www.mocky.io/v2/5185415ba171ea3a00704eed 

mocky.io may be using www to differentiate between subdomains. That is why its not worked when adding http only.

2 Comments

Thank you for saying this specifically but I need the certification to be ignored while calling the api. Is there any way? upvoted();
@AllwiN I don't know how to ignore this with http package. But you can do it by directly using HttpClient class. See here

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.