aws/amazon-ec2-metadata-mock

Support trailing / and subpath listings

bwagner5 opened this issue · 1 comments

ec2-metadata-mock should support a trailing slash:

## CURRENT BEHAVIOR
$ curl localhost:1338/latest/meta-data/instance-type/
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
  <title>404 - Not Found</title>
 </head>
 <body>
  <h1>404 - Not Found</h1>
 </body>
</html>

## Without the trailing slash works fine
$ curl localhost:1338/latest/meta-data/instance-type
m4.xlarge

## SHOULD RETURN
$ ec2-metadata-mock -p 1338 &
$ curl localhost:1338/latest/meta-data/instance-type/
m4.xlarge

Also, when querying paths, ec2-metadata-mock should list the subpaths:

## CURRENT BEHAVIOR
$ ec2-metadata-mock -p 1338 &
$ curl localhost:1338/latest/meta-data/spot
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
  <title>404 - Not Found</title>
 </head>
 <body>
  <h1>404 - Not Found</h1>
 </body>
</html>

## SHOULD RETURN
$ curl localhost:1338/latest/meta-data/spot
instance-action
termination-time

PR #80 enables both of these features. Will resolve once a release is cut