Hi everyone!
Just made a simple HTTP client. It's based on Nim std/httpclient, has no additional dependencies and has nice (at least I think so) API. A couple of examples:
import yahttp
# Getting HTTP response statuse code
echo get("https://www.google.com/").status
# Making request with query params and accessing response body as JSON
let laptopsJson = get("https://dummyjson.com/products/search", query = {"q": "Laptop"}).json()
echo laptopsJson["products"][0]["title"].getStr()
Check it out if you are interested - https://github.com/mishankov/yahttp Feedback is appreciated :) Hello. If I use yahttp in a project, then should I compile it with -d:ssl?
And it needs to be distributed with library libssl and cacert.pem?
I think so, but I would like to confirm.
Thanks for the great work
Hi!
SSL flag is only required if you call https endpoints (probably you do)
I distribute one of my application that uses yahttp with libcrypto and libssl
Hi,
I'm developing a module which is an interface for an API.
This API is running on an old virtual server Windows 2008.
Calling api with http protocol is all ok.
With the default setting of openssl in Nim, when I use https, there is a problem in handshaking phase.
Using httpclient the solution is to set sslcontext:
sslContext = newContext(protVersion = protSSLv23, cipherList=CiphersOld, ciphersuites=CiphersOld)
Is there any way to do this using yahttp?
Thanks
Hi @MauroG
Check out sslContext function argument in version 0.12.0 for providing custom SSL context
⛵ v0.13.0 is available
Support for sending files was added - https://github.com/mishankov/yahttp/releases/tag/v0.13.0
Hi mishankov. I've upgraded yahttp but in compile time I have this error
yahttp.nim(102, 20) Error: type mismatch
Expected one of (first mismatch at [position]):
⛵ v0.14.0 is available
yahttp now supports simultaneous usage of files and streamingFiles - https://github.com/mishankov/yahttp/releases/tag/v0.14.0