mirror of https://github.com/docusealco/docuseal
				
				
				
			
			You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							18 lines
						
					
					
						
							365 B
						
					
					
				
			
		
		
	
	
							18 lines
						
					
					
						
							365 B
						
					
					
				# frozen_string_literal: true
 | 
						|
 | 
						|
class ApiPathConsiderJsonMiddleware
 | 
						|
  def initialize(app)
 | 
						|
    @app = app
 | 
						|
  end
 | 
						|
 | 
						|
  def call(env)
 | 
						|
    if env['PATH_INFO'].starts_with?('/api') &&
 | 
						|
       !env['PATH_INFO'].ends_with?('/documents') &&
 | 
						|
       !env['PATH_INFO'].ends_with?('/attachments')
 | 
						|
      env['CONTENT_TYPE'] = 'application/json'
 | 
						|
    end
 | 
						|
 | 
						|
    @app.call(env)
 | 
						|
  end
 | 
						|
end
 |