@@ -37,18 +37,11 @@ func newRuntimeAPIClient(address string) *runtimeAPIClient {
37
37
client := & http.Client {
38
38
Timeout : 0 , // connections to the runtime API are never expected to time out
39
39
}
40
- endpoint := "http://" + address + "/" + apiVersion + "/runtime"
40
+ endpoint := "http://" + address + "/" + apiVersion + "/runtime/invocation/ "
41
41
userAgent := "aws-lambda-go/" + runtime .Version ()
42
42
return & runtimeAPIClient {endpoint , userAgent , client , bytes .NewBuffer (nil )}
43
43
}
44
44
45
- // initError connects to the Runtime API and reports that a failure occured during initialization.
46
- // Note: After calling this function, the caller should call os.Exit()
47
- func (c * runtimeAPIClient ) initError (body io.Reader , contentType string ) error {
48
- url := c .baseURL + "/init/error"
49
- return c .post (url , body , contentType )
50
- }
51
-
52
45
type invoke struct {
53
46
id string
54
47
payload []byte
@@ -60,7 +53,7 @@ type invoke struct {
60
53
// Notes:
61
54
// - An invoke is not complete until next() is called again!
62
55
func (i * invoke ) success (body io.Reader , contentType string ) error {
63
- url := i .client .baseURL + "/invocation/" + i .id + "/response"
56
+ url := i .client .baseURL + i .id + "/response"
64
57
return i .client .post (url , body , contentType )
65
58
}
66
59
@@ -70,14 +63,14 @@ func (i *invoke) success(body io.Reader, contentType string) error {
70
63
// - A Lambda Function continues to be re-used for future invokes even after a failure.
71
64
// If the error is fatal (panic, unrecoverable state), exit the process immediately after calling failure()
72
65
func (i * invoke ) failure (body io.Reader , contentType string ) error {
73
- url := i .client .baseURL + "/invocation/" + i .id + "/error"
66
+ url := i .client .baseURL + i .id + "/error"
74
67
return i .client .post (url , body , contentType )
75
68
}
76
69
77
70
// next connects to the Runtime API and waits for a new invoke Request to be available.
78
71
// Note: After a call to Done() or Error() has been made, a call to next() will complete the in-flight invoke.
79
72
func (c * runtimeAPIClient ) next () (* invoke , error ) {
80
- url := c .baseURL + "/invocation/ next"
73
+ url := c .baseURL + "next"
81
74
req , err := http .NewRequest (http .MethodGet , url , nil )
82
75
if err != nil {
83
76
return nil , fmt .Errorf ("failed to construct GET request to %s: %v" , url , err )
0 commit comments