fix: url_api field format on news endpoints #452
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request includes several changes to improve the configuration and initialization of the TibiaData API, as well as enhancements to the user agent generation. The most important changes include adding support for specifying the protocol used by the TibiaData API, refactoring the initialization process, and updating the user agent generator to include protocol information.
Configuration enhancements:
src/main.go
: Added a new configuration variableTibiaDataProtocol
to allow specifying the protocol used by the TibiaData API. This can be overridden by the environment variableTIBIADATA_PROTOCOL
.src/main.go
: Updated theTibiaDataInitializer
function to log the protocol and hostname information.Initialization refactoring:
src/main.go
: Refactored the initialization process to ensure theTibiaDataInitializer
function is called before generating the user agent and initiating the validator. [1] [2]User agent generation enhancements:
src/webserver.go
: Updated theTibiaDataUserAgentGenerator
function to include the protocol and hostname in the user agent string if the hostname is set.src/main_test.go
: Added tests to verify the user agent generation with and without the hostname and protocol.API URL construction:
src/TibiaNewslist.go
: Modified the construction of theApiURL
to include the protocol specified byTibiaDataProtocol
.fix #450