Move xml parsing to epp constraint #2752

This commit is contained in:
Martin Lensment 2015-07-23 13:31:22 +03:00
parent 2148cc57e5
commit c94da28af6
2 changed files with 5 additions and 5 deletions

View file

@ -9,10 +9,10 @@ class EppController < ApplicationController
before_action :validate_against_schema
def validate_against_schema
return if params[:action] == 'hello'
return if ['hello', 'error'].include?(params[:action])
params[:schema] = 'epp-1.0.xsd' unless params[:schema]
xsd = Nokogiri::XML::Schema(File.read("lib/schemas/#{params[:schema]}"))
xsd.validate(Nokogiri::XML(params[:raw_frame])).each do |error|
xsd.validate(params[:nokogiri_frame]).each do |error|
epp_errors << {
code: 2001,
msg: error