Skip to content

Commit 291e2ef

Browse files
Replace hard-coded version number with http_version variable (#47)
* replace hard-coded version number with http_version variable * Storing package version to http_version.90
1 parent 20fa99e commit 291e2ef

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/http/http_client.f90

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ module http_client
2626
use http_request, only: request_type
2727
use http_response, only: response_type
2828
use http_pair, only: append_pair, pair_has_name, pair_type
29+
use http_version, only: VERSION_STRING
2930

3031
implicit none
3132

@@ -94,10 +95,10 @@ function new_request(url, method, header, data, form, file, timeout, auth) resul
9495
request%header = header
9596
! Set default request headers.
9697
if (.not. pair_has_name(header, 'user-agent')) then
97-
call append_pair(request%header, 'user-agent', 'fortran-http/0.1.0')
98+
call append_pair(request%header, 'user-agent', 'http-client/'//VERSION_STRING)
9899
end if
99100
else
100-
request%header = [pair_type('user-agent', 'fortran-http/0.1.0')]
101+
request%header = [pair_type('user-agent', 'http-client/'//VERSION_STRING)]
101102
end if
102103

103104
! setting the request data to be send

src/http/http_version.f90

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module http_version
2+
!! This module store information regarding version
3+
!! number of package
4+
integer, parameter, public :: VERSION_MAJOR = 0
5+
!! major version number
6+
integer, parameter, public :: VERSION_MINOR = 1
7+
!! minor version number
8+
character(len=*), parameter, public :: VERSION_STRING = achar(VERSION_MAJOR + 48) // '.' // achar(VERSION_MINOR + 48)
9+
end module http_version

0 commit comments

Comments
 (0)