@@ -37,18 +37,11 @@ func newRuntimeAPIClient(address string) *runtimeAPIClient {
3737 client := & http.Client {
3838 Timeout : 0 , // connections to the runtime API are never expected to time out
3939 }
40- endpoint := "http://" + address + "/" + apiVersion + "/runtime"
40+ endpoint := "http://" + address + "/" + apiVersion + "/runtime/invocation/ "
4141 userAgent := "aws-lambda-go/" + runtime .Version ()
4242 return & runtimeAPIClient {endpoint , userAgent , client , bytes .NewBuffer (nil )}
4343}
4444
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-
5245type invoke struct {
5346 id string
5447 payload []byte
@@ -60,7 +53,7 @@ type invoke struct {
6053// Notes:
6154// - An invoke is not complete until next() is called again!
6255func (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"
6457 return i .client .post (url , body , contentType )
6558}
6659
@@ -70,14 +63,14 @@ func (i *invoke) success(body io.Reader, contentType string) error {
7063// - A Lambda Function continues to be re-used for future invokes even after a failure.
7164// If the error is fatal (panic, unrecoverable state), exit the process immediately after calling failure()
7265func (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"
7467 return i .client .post (url , body , contentType )
7568}
7669
7770// next connects to the Runtime API and waits for a new invoke Request to be available.
7871// Note: After a call to Done() or Error() has been made, a call to next() will complete the in-flight invoke.
7972func (c * runtimeAPIClient ) next () (* invoke , error ) {
80- url := c .baseURL + "/invocation/ next"
73+ url := c .baseURL + "next"
8174 req , err := http .NewRequest (http .MethodGet , url , nil )
8275 if err != nil {
8376 return nil , fmt .Errorf ("failed to construct GET request to %s: %v" , url , err )
0 commit comments