mirror of
				https://git.sleeping.town/mirrors/foxy-moxy
				synced 2025-11-03 10:02:34 -08:00 
			
		
		
		
	Handle Etag and If-none-match headers and 304 responses
This commit is contained in:
		
							parent
							
								
									a674d6a79c
								
							
						
					
					
						commit
						1b95c4c794
					
				
					 2 changed files with 29 additions and 4 deletions
				
			
		
							
								
								
									
										15
									
								
								test/test.js
									
										
									
									
									
								
							
							
						
						
									
										15
									
								
								test/test.js
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -50,6 +50,21 @@ describe('Foxy-moxy v1', () => {
 | 
			
		|||
 | 
			
		||||
describe('Foxy-moxy v2', () => {
 | 
			
		||||
  describe('fox generation', () => {
 | 
			
		||||
    it('should give 304 when presented with correct etag', (done) = async function () {
 | 
			
		||||
      const uncachedResponse = await request(app)
 | 
			
		||||
        .get(`/2/400/${testUID}`)
 | 
			
		||||
        .expect('Content-Type', 'image/png')
 | 
			
		||||
        .expect(200)
 | 
			
		||||
 | 
			
		||||
      const cachedResponse = await request(app)
 | 
			
		||||
        .get(`/2/400/${testUID}`)
 | 
			
		||||
        .set('If-None-Match', uncachedResponse.headers.etag)
 | 
			
		||||
        .expect('Content-Type', 'image/png')
 | 
			
		||||
        .expect(304)
 | 
			
		||||
 | 
			
		||||
      done()
 | 
			
		||||
    })
 | 
			
		||||
 | 
			
		||||
    it('should respect widths < 400', (done) => {
 | 
			
		||||
      const width = 158
 | 
			
		||||
      request(app)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue