mirror of
				https://github.com/eledio-cloud/standard-redirects-for-cloudfront.git
				synced 2025-10-31 00:12:56 +01:00 
			
		
		
		
	fixed a problem with network-path references (see https://datatracker.ietf.org/doc/html/rfc3986#section-4.2), updated mocha
This commit is contained in:
		
							
								
								
									
										35
									
								
								test/unit.js
									
									
									
									
									
								
							
							
						
						
									
										35
									
								
								test/unit.js
									
									
									
									
									
								
							| @@ -56,7 +56,7 @@ describe('Testing index.js', function() { | ||||
|       done(assert.strictEqual(data.uri, '/foo/bar/index.html')); | ||||
|     }); | ||||
|   }); | ||||
|    | ||||
|  | ||||
|   it('/foo -> external redirect (301) -> /foo/', function(done) { | ||||
|     const event = { | ||||
|       Records:[{ cf: { | ||||
| @@ -65,7 +65,7 @@ describe('Testing index.js', function() { | ||||
|           } | ||||
|         } }] }; | ||||
|     index.handler(event, {}, (err, data) => { | ||||
|       done(assert.strictEqual(data.status, '301')  | ||||
|       done(assert.strictEqual(data.status, '301') | ||||
|           || assert.strictEqual(data.headers.location[0].key, 'Location') | ||||
|           || assert.strictEqual(data.headers.location[0].value, '/foo/')); | ||||
|     }); | ||||
| @@ -101,9 +101,38 @@ describe('Testing index.js', function() { | ||||
|           } | ||||
|         } }] }; | ||||
|     index.handler(event, {}, (err, data) => { | ||||
|       done(assert.strictEqual(data.status, '301')  | ||||
|       done(assert.strictEqual(data.status, '301') | ||||
|           || assert.strictEqual(data.headers.location[0].key, 'Location') | ||||
|           || assert.strictEqual(data.headers.location[0].value, '/foo/')); | ||||
|     }); | ||||
|   }); | ||||
|  | ||||
|   it('//foo/index.html -> external redirect (301) -> /foo/', function(done) { | ||||
|     const event = { | ||||
|       Records:[{ cf: { | ||||
|           request:  { | ||||
|             uri: '//foo/index.html' | ||||
|           } | ||||
|         } }] }; | ||||
|     index.handler(event, {}, (err, data) => { | ||||
|       done(assert.strictEqual(data.status, '301') | ||||
|           || assert.strictEqual(data.headers.location[0].key, 'Location') | ||||
|           || assert.strictEqual(data.headers.location[0].value, '/foo/')); | ||||
|     }); | ||||
|   }); | ||||
|  | ||||
|   it('///foo -> external redirect (301) -> /foo/', function(done) { | ||||
|     const event = { | ||||
|       Records:[{ cf: { | ||||
|           request:  { | ||||
|             uri: '//foo/index.html' | ||||
|           } | ||||
|         } }] }; | ||||
|     index.handler(event, {}, (err, data) => { | ||||
|       done(assert.strictEqual(data.status, '301') | ||||
|           || assert.strictEqual(data.headers.location[0].key, 'Location') | ||||
|           || assert.strictEqual(data.headers.location[0].value, '/foo/')); | ||||
|     }); | ||||
|   }); | ||||
|  | ||||
| }); | ||||
		Reference in New Issue
	
	Block a user