mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-31 18:02:25 -05:00 
			
		
		
		
	[feature] Gin enable gzip encoding (#405)
* add gin gzip dependency * add gzip middleware to router * go mod tidy
This commit is contained in:
		
					parent
					
						
							
								23034ec145
							
						
					
				
			
			
				commit
				
					
						a089a98ea9
					
				
			
		
					 11 changed files with 442 additions and 5 deletions
				
			
		
							
								
								
									
										30
									
								
								internal/router/gzip.go
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								internal/router/gzip.go
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,30 @@ | |||
| /* | ||||
|    GoToSocial | ||||
|    Copyright (C) 2021-2022 GoToSocial Authors admin@gotosocial.org | ||||
| 
 | ||||
|    This program is free software: you can redistribute it and/or modify | ||||
|    it under the terms of the GNU Affero General Public License as published by | ||||
|    the Free Software Foundation, either version 3 of the License, or | ||||
|    (at your option) any later version. | ||||
| 
 | ||||
|    This program is distributed in the hope that it will be useful, | ||||
|    but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|    GNU Affero General Public License for more details. | ||||
| 
 | ||||
|    You should have received a copy of the GNU Affero General Public License | ||||
|    along with this program.  If not, see <http://www.gnu.org/licenses/>. | ||||
| */ | ||||
| 
 | ||||
| package router | ||||
| 
 | ||||
| import ( | ||||
| 	ginGzip "github.com/gin-contrib/gzip" | ||||
| 	"github.com/gin-gonic/gin" | ||||
| ) | ||||
| 
 | ||||
| func useGzip(engine *gin.Engine) error { | ||||
| 	gzipMiddleware := ginGzip.Gzip(ginGzip.DefaultCompression) | ||||
| 	engine.Use(gzipMiddleware) | ||||
| 	return nil | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue