Commit 50375d55 authored by Chris Molozian's avatar Chris Molozian
Browse files

Add timeout option to HTTP request function in code runtime.

parent 1aa3af92
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -4,6 +4,9 @@ All notable changes to this project are documented below.
The format is based on [keep a changelog](http://keepachangelog.com) and this project uses [semantic versioning](http://semver.org).

## [Unreleased]
### Added
- New timeout option to HTTP request function in the code runtime.


## [2.0.0] - 2018-05-14

+4 −0
Original line number Diff line number Diff line
@@ -532,6 +532,10 @@ func (n *NakamaModule) httpRequest(l *lua.LState) int {
		return 0
	}

	// Set a custom timeout if one is provided, or use the default.
	timeoutMs := l.OptInt64(5, 5000)
	n.client.Timeout = time.Duration(timeoutMs) * time.Millisecond

	// Prepare request body, if any.
	var requestBody io.Reader
	if body != "" {