Skip to content

Commit

Permalink
1.0.1
Browse files Browse the repository at this point in the history
returning correct Location header on POST
  • Loading branch information
Igrom committed Apr 22, 2018
1 parent 66755fa commit 8041e45
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,14 @@
"method.response.header.Location": "integration.response.body.Attributes.ShortUrl.S"
},
"responseTemplates": {
"application/json": "#set($id = $input.json(\"$.Attributes.ShortUrl.S\").replace('\"', \"\"))\n{\n \"longUrl\": $input.json(\"$.Attributes.LongUrl.S\"),\n \"shortUrl\": \"https://$GATEFOLD_DOMAIN/$id\",\n \"token\": $input.json(\"$.Attributes.Token.S\")\n}"
"application/json": "#set($short = $input.json(\"$.Attributes.ShortUrl.S\").replace('\"', \"\"))\n{\n \"longUrl\": $input.json(\"$.Attributes.LongUrl.S\"),\n \"shortUrl\": \"$short\",\n \"token\": $input.json(\"$.Attributes.Token.S\")\n}"
}
}
},
"passthroughBehavior": "never",
"httpMethod": "POST",
"requestTemplates": {
"application/json": "#set ($guid = $context.requestId)\n#set ($suffix1 = $guid.substring(0,4))\n#set ($suffix2 = $guid.substring(24,28))\n#set ($suffix = \"$suffix1$suffix2\")\n#set ($token = $guid.substring(0))\n#set ($ttl = $context.requestTimeEpoch + 86400 * $GATEFOLD_TTL)\n{\n \"TableName\": \"gatefold-$GATEFOLD_DOMAIN\",\n \"Key\": {\n \"ShortUrl\": {\n \"S\": \"$suffix\"\n }\n },\n \"ExpressionAttributeNames\": {\n \"#Token\": \"Token\"\n },\n \"ExpressionAttributeValues\": {\n \":longUrl\": {\n \"S\": $input.json(\"$.longUrl\")\n },\n \":token\": {\n \"S\": \"$token\"\n },\n \":currentTime\": {\n \"S\": \"$context.requestTimeEpoch\"\n },\n \":expiresAt\": {\n \"S\": \"$ttl\"\n }\n },\n \"UpdateExpression\": \"SET LongUrl = :longUrl, #Token = :token, CreatedAt = :currentTime, ModifiedAt = :currentTime, ExpiresAt = :expiresAt\",\n \"ConditionExpression\": \"attribute_not_exists(ShortUrl)\",\n \"ReturnValues\": \"ALL_NEW\"\n}"
"application/json": "#set ($guid = $context.requestId)\n#set ($suffix1 = $guid.substring(0,4))\n#set ($suffix2 = $guid.substring(24,28))\n#set ($short = \"https://$GATEFOLD_DOMAIN/$suffix1$suffix2\")\n#set ($token = $guid.substring(0))\n#set ($ttl = $context.requestTimeEpoch + 86400 * $GATEFOLD_TTL)\n{\n \"TableName\": \"gatefold-$GATEFOLD_DOMAIN\",\n \"Key\": {\n \"ShortUrl\": {\n \"S\": \"$short\"\n }\n },\n \"ExpressionAttributeNames\": {\n \"#Token\": \"Token\"\n },\n \"ExpressionAttributeValues\": {\n \":longUrl\": {\n \"S\": $input.json(\"$.longUrl\")\n },\n \":token\": {\n \"S\": \"$token\"\n },\n \":currentTime\": {\n \"S\": \"$context.requestTimeEpoch\"\n },\n \":expiresAt\": {\n \"S\": \"$ttl\"\n }\n },\n \"UpdateExpression\": \"SET LongUrl = :longUrl, #Token = :token, CreatedAt = :currentTime, ModifiedAt = :currentTime, ExpiresAt = :expiresAt\",\n \"ConditionExpression\": \"attribute_not_exists(ShortUrl)\",\n \"ReturnValues\": \"ALL_NEW\"\n}"
},
"type": "aws"
}
Expand Down Expand Up @@ -424,14 +424,14 @@
"method.response.header.Access-Control-Allow-Origin": "'*'"
},
"responseTemplates": {
"application/json": "#set($id = $input.json(\"$.Attributes.ShortUrl.S\").replace('\"', \"\"))\n{\n \"longUrl\": $input.json(\"$.Attributes.LongUrl.S\"),\n \"shortUrl\": \"https://$GATEFOLD_DOMAIN/$id\",\n \"token\": $input.json(\"$.Attributes.Token.S\")\n}"
"application/json": "#set($short = $input.json(\"$.Attributes.ShortUrl.S\").replace('\"', \"\"))\n{\n \"longUrl\": $input.json(\"$.Attributes.LongUrl.S\"),\n \"shortUrl\": \"$short\",\n \"token\": $input.json(\"$.Attributes.Token.S\")\n}"
}
}
},
"passthroughBehavior": "never",
"httpMethod": "POST",
"requestTemplates": {
"application/json": "#set ($suffix = $input.params(\"id\"))\n#set ($ttl = $context.requestTimeEpoch + 86400 * $GATEFOLD_TTL)\n#set ($token = $input.json(\"$.token\"))\n{\n \"TableName\": \"gatefold-$GATEFOLD_DOMAIN\",\n \"Key\": {\n \"ShortUrl\": {\n \"S\": \"$suffix\"\n }\n },\n \"ExpressionAttributeNames\": {\n \"#Token\": \"Token\"\n },\n \"ExpressionAttributeValues\": {\n \":longUrl\": {\n \"S\": $input.json('$.longUrl')\n },\n \":token\": {\n \"S\": $token\n },\n \":currentTime\": {\n \"S\": \"$context.requestTimeEpoch\"\n },\n \":expiresAt\": {\n \"S\": \"$ttl\"\n }\n },\n \"UpdateExpression\": \"SET LongUrl = :longUrl, #Token = :token, CreatedAt = if_not_exists(CreatedAt, :currentTime), ModifyTime = :currentTime, ExpiresAt = :expiresAt\",\n \"ConditionExpression\": \"(attribute_not_exists(ShortUrl)) or (#Token = :token)\",\n \"ReturnValues\": \"ALL_NEW\"\n}"
"application/json": "#set ($suffix = $input.params(\"id\"))\n#set ($ttl = $context.requestTimeEpoch + 86400 * $GATEFOLD_TTL)\n#set ($token = $input.json(\"$.token\"))\n{\n \"TableName\": \"gatefold-$GATEFOLD_DOMAIN\",\n \"Key\": {\n \"ShortUrl\": {\n \"S\": \"https://$GATEFOLD_DOMAIN/$suffix\"\n }\n },\n \"ExpressionAttributeNames\": {\n \"#Token\": \"Token\"\n },\n \"ExpressionAttributeValues\": {\n \":longUrl\": {\n \"S\": $input.json('$.longUrl')\n },\n \":token\": {\n \"S\": $token\n },\n \":currentTime\": {\n \"S\": \"$context.requestTimeEpoch\"\n },\n \":expiresAt\": {\n \"S\": \"$ttl\"\n }\n },\n \"UpdateExpression\": \"SET LongUrl = :longUrl, #Token = :token, CreatedAt = if_not_exists(CreatedAt, :currentTime), ModifyTime = :currentTime, ExpiresAt = :expiresAt\",\n \"ConditionExpression\": \"(attribute_not_exists(ShortUrl)) or (#Token = :token)\",\n \"ReturnValues\": \"ALL_NEW\"\n}"
},
"type": "aws"
}
Expand Down Expand Up @@ -517,7 +517,7 @@
"passthroughBehavior": "never",
"httpMethod": "POST",
"requestTemplates": {
"application/json": "{\n \"TableName\": \"gatefold-$GATEFOLD_DOMAIN\",\n \"Key\": {\n \"ShortUrl\": {\n \"S\": \"$input.params(\"id\")\"\n }\n }\n}"
"application/json": "{\n \"TableName\": \"gatefold-$GATEFOLD_DOMAIN\",\n \"Key\": {\n \"ShortUrl\": {\n \"S\": \"https://$GATEFOLD_DOMAIN/$input.params(\"id\")\"\n }\n }\n}"
},
"type": "aws"
}
Expand Down

0 comments on commit 8041e45

Please sign in to comment.