diff --git a/app/controllers/registrar/registrar_nameservers_controller.rb b/app/controllers/registrar/registrar_nameservers_controller.rb index b4776f70e..1af3cde64 100644 --- a/app/controllers/registrar/registrar_nameservers_controller.rb +++ b/app/controllers/registrar/registrar_nameservers_controller.rb @@ -11,7 +11,7 @@ class Registrar ipv6 = params[:ipv6].split("\r\n") uri = URI.parse("#{ENV['repp_url']}registrar/nameservers") - request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json') + request = Net::HTTP::Put.new(uri, 'Content-Type' => 'application/json') request.body = { data: { type: 'nameserver', id: params[:old_hostname], attributes: { hostname: params[:new_hostname], ipv4: ipv4, diff --git a/test/integration/registrar/nameserver_replacement_test.rb b/test/integration/registrar/nameserver_replacement_test.rb index bf0c1e44e..a6c1dcb7b 100644 --- a/test/integration/registrar/nameserver_replacement_test.rb +++ b/test/integration/registrar/nameserver_replacement_test.rb @@ -12,9 +12,9 @@ class RegistrarNameserverReplacementTest < ActionDispatch::IntegrationTest attributes: { hostname: 'new-ns.bestnames.test', ipv4: %w[192.0.2.55 192.0.2.56], ipv6: %w[2001:db8::55 2001:db8::56] } } } - request_stub = stub_request(:post, /registrar\/nameservers/).with(body: request_body, - headers: { 'Content-type' => 'application/json' }, - basic_auth: ['test_goodnames', 'testtest']) + request_stub = stub_request(:put, /registrar\/nameservers/).with(body: request_body, + headers: { 'Content-type' => 'application/json' }, + basic_auth: ['test_goodnames', 'testtest']) .to_return(body: { data: [{ type: 'nameserver', id: 'new-ns.bestnames.test' @@ -35,9 +35,9 @@ class RegistrarNameserverReplacementTest < ActionDispatch::IntegrationTest end def test_fails_gracefully - stub_request(:post, /registrar\/nameservers/).to_return(status: 400, - body: { errors: [{ title: 'epic fail' }] }.to_json, - headers: { 'Content-type' => 'application/json' }) + stub_request(:put, /registrar\/nameservers/).to_return(status: 400, + body: { errors: [{ title: 'epic fail' }] }.to_json, + headers: { 'Content-type' => 'application/json' }) visit registrar_domains_url click_link 'Replace nameserver'