Closed vypivshiy closed 3 months ago
Hello! I used your library to make a telegram bot, but the response from the getMe method is parsed with an error.
OS: Linux Mint 21.2 x86_64 Kernel: 5.15.0-79-generic CPU: Intel i5-10400F (12) @ 4.300GHz Compiler: gfortran 11.4.0
without http_client
program main use json_module, only: json_file implicit none type(json_file) :: json character(:), allocatable :: jsn_string jsn_string = '{"ok":true,"result":{"id":12345678,"is_bot":true,' // & '"first_name":"pavel","username":"durov",' // & '"can_join_groups":true,"can_read_all_group_messages":false,' // & '"supports_inline_queries":false}}' call json%initialize() call json%deserialize(jsn_string) print*, json%failed() ! T end program
with http_client
program main use json_module, only: json_file use http, only : request, response_type, HTTP_POST, pair_type implicit none character(:), allocatable :: TOKEN character(:), allocatable :: api_url character(:), allocatable :: payload type(json_file) :: json ! http variables type(pair_type), allocatable :: req_header(:) type(response_type) :: response ! telegram bot valid token variable TOKEN = "TELEGRAM_BOT_TOKEN" ! prepare request payload = "{}" api_url = "https://api.telegram.org/bot"//TOKEN//"/getMe" req_header = [pair_type('Content-Type', 'application/json')] ! send request response = request(api_url, method=HTTP_POST, data=payload, header=req_header) call json%initialize() call json%deserialize(response%content) print*, json%failed() ! T end program
The first one works fine for me. What compiler/platform are you using?
Description
Hello! I used your library to make a telegram bot, but the response from the getMe method is parsed with an error.
System
OS: Linux Mint 21.2 x86_64 Kernel: 5.15.0-79-generic CPU: Intel i5-10400F (12) @ 4.300GHz Compiler: gfortran 11.4.0
Libraries used
Reproduction
without http_client
with http_client