我正在使用第三方短信结算系统。
当我从该系统收到GET请求时,我需要使用标头发回一些数据。
我的控制器:
if @billing.present? && @advertisement.present?
@payment = Payment.new
@payment.identifier = @advertisement.identifier
@payment.sms_id = sms_id
@payment.operator_id = operator_id
@payment.from = from
@payment.to = to
@payment.billing_id = @billing.id
@payment.advertisement_id = @advertisement.id
@payment.content = text
@payment.save
response.headers["x-esteria-price"] = @billing.price
flash[:notice] = "Īsziņa satur pakalpojuma kodu = #{code} identifikātors = #{identifier} .Charged = #{charged} Pirmais pieprasījums !!! "
else
params[:answer] = "Atvainojiet, Jus neesat noradijusi lietotajvardu (login)SMS teksta. Uzmanigi parbaudiet nosutito tekstu!"
params[:price] = 0.10 #???
response.headers["x-esteria-price: 0.10"] #jānorāda ka nepareizi dati !! ATBILDES ZIŅA UN CENA
flash[:notice] = "NEIZDEVĀS. Trūkst pakalpojums vai attiecīgais sludinājums.Atvainojiet, Jus neesat noradijusi lietotajvardu (login)SMS teksta. Uzmanigi parbaudiet nosutito tekstu!"
end
我试过了:
response.headers["x-esteria-price: #{@billing.price}"]
这不会在Chrome网络/标题面板中提供任何内容:
Cache-Control:max-age=0, private, must-revalidate
Connection:close
Content-Type:text/html; charset=utf-8
ETag:"a3c16129b9bd85f4fb98a5a839865823"
Server:thin 1.5.1 codename Straight Razor
Set-Cookie:country_id=1; path=/
Set-Cookie:_Proj_session=WmgyZTRPQ3BpSmhqVVdOUC9CT3M4dUZob0FPTFpLaXhxNHNKc2lJK0QrYWNLS3BoNVFoK1E5Uml2TElGLzl6MWpiL3h4cWFDcXBmTFdIU0NOeWRnalBvS09wY3dxdjN2eDZhMFREajJBUXUva2tHdjBKcEExelB5R2lHVDJFOHErNWNsQVhPbXhTdXRZMkdVSlY5L0lyM0Z0eTd0ekM4MnE4TDJwVFlpQ0NZbklzT2VhU0o5VjBudzJJVnE5bXlKODROblgxa2J6TDNweTRTMm91UXhDMGxBZ3Q4Mmpoek90RkxUdXlGR0pIN3FkQTVQaTlpV1QxdE1SNXBZaDNNOC9RR0JTNjZTaURBNXgyc0pQOTZIZkUzZ3FBZDIydk9QaEo0UUFIcXVGY0Z4TXpWeTQ1anVhUjlKaFZaUjUza2J0Tzk0SzAyRTRoZ245ck9ydjQwZkluYVZhUnZidU5scUQwZk9JR1I5OEVCcnBFTjdsVzdlOU1FT1VVS3dsSFFLV1JFSURBbTFnaFpwbDN6d3dDamQ1SlgvUi95R00yUFkySVpaOU9PNzYvSVVaRlVSWHJ6bHNBbS8vZ2dsdkdJOXhoSzNzTmltSGtQYkdVbkswL2hzRlYwenFjWDR3RmJLdGE2eUVBaTNLMWdMUHB3a3ZyaTYrcW1wYXMxSnQ1a3VYVGZSUDVLM2h2L25TS1J0VGVYWTNxV1o4M29Nc3c4RmRUUDNyazUzUUdRPS0tY0JibS9KblRYOGtFdHprRkt6MnBUdz09--c3e31e1f5d82414800255d77725197037d887cf6; path=/; HttpOnly
X-Content-Type-Options:nosniff
X-Frame-Options:SAMEORIGIN
X-Request-Id:5c1f2c42-80c5-4613-ba8c-2ad14d6e116e
X-Runtime:0.493049
X-XSS-Protection:1; mode=block
和
response.headers["x-esteria-price"] = @billing.price
这给了我内部服务器错误,但没有任何进一步的解释。
我的development.log
Started GET "/sms/receive?sms-id=7bb28e244189f2cf36cbebb9d1d4d02001da53ab&operator-%20id=1&from=37126300682&to=371144&text=ILR3+30895" for 127.0.0.1 at 2015-02-11 22:39:42 +0200
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT `schema_migrations`.* FROM `schema_migrations`[0m
Processing by SmsController#receive as HTML
Parameters: {"sms-id"=>"7bb28e244189f2cf36cbebb9d1d4d02001da53ab", "operator- id"=>"1", "from"=>"37126300682", "to"=>"371144", "text"=>"ILR3 30895"}
[1m[35mCountry Load (0.2ms)[0m SELECT `countries`.* FROM `countries` WHERE `countries`.`id` = 1 LIMIT 1
[1m[36m (0.5ms)[0m [1mSELECT COUNT(*) FROM `advertisements` WHERE (country_id=1) AND (vip_recomend >= '2015-02-11 22:39:42')[0m
[1m[35m (0.4ms)[0m SELECT COUNT(*) FROM `advertisements` WHERE (country_id=1) AND (recomend >= '2015-02-11 22:39:42')
[1m[36m (0.4ms)[0m [1mSELECT COUNT(*) FROM `advertisements` WHERE (country_id=1) AND (highlight >= '2015-02-11 22:39:42')[0m
[1m[35m (0.3ms)[0m SELECT COUNT(*) FROM `advertisements` WHERE (country_id=1) AND (vip_highlight >= '2015-02-11 22:39:42')
[1m[36mList Load (0.2ms)[0m [1mSELECT `lists`.* FROM `lists` WHERE (billing_id =4) ORDER BY `lists`.`id` ASC LIMIT 1[0m
[1m[35mList Load (0.2ms)[0m SELECT `lists`.* FROM `lists` WHERE (billing_id =5) ORDER BY `lists`.`id` ASC LIMIT 1
[1m[36mCACHE (0.0ms)[0m [1mSELECT `lists`.* FROM `lists` WHERE (billing_id =5) ORDER BY `lists`.`id` ASC LIMIT 1[0m
[1m[35mList Load (0.1ms)[0m SELECT `lists`.* FROM `lists` WHERE (billing_id =3) ORDER BY `lists`.`id` ASC LIMIT 1
[1m[36mBilling Load (0.2ms)[0m [1mSELECT `billings`.* FROM `billings` WHERE `billings`.`name` = 'ILR3' LIMIT 1[0m
[1m[35mAdvertisement Load (0.2ms)[0m SELECT `advertisements`.* FROM `advertisements` WHERE (identifier = '30895') LIMIT 1
[1m[36m (0.2ms)[0m [1mBEGIN[0m
[1m[35mSQL (0.3ms)[0m INSERT INTO `payments` (`advertisement_id`, `billing_id`, `content`, `created_at`, `from`, `identifier`, `sms_id`, `to`, `updated_at`) VALUES (85, 4, 'ILR3 30895', '2015-02-11 22:39:43', '37126300682', 30895, '7bb28e244189f2cf36cbebb9d1d4d02001da53ab', 371144, '2015-02-11 22:39:43')
[1m[36m (39.8ms)[0m [1mCOMMIT[0m
Rendered sms/receive.html.erb within layouts/application (1.6ms)
[1m[35mBanner Load (0.1ms)[0m SELECT `banners`.* FROM `banners` WHERE (country_id = 1) ORDER BY `banners`.`id` ASC LIMIT 1
[1m[36mBanner Load (0.3ms)[0m [1mSELECT `banners`.* FROM `banners` WHERE (country_id = 1) ORDER BY `banners`.`id` DESC LIMIT 1[0m
[1m[35mAdvertisement Load (0.3ms)[0m SELECT `advertisements`.* FROM `advertisements` WHERE `advertisements`.`id` = 85 ORDER BY `advertisements`.`id` ASC LIMIT 1
[1m[36mRegion Load (0.2ms)[0m [1mSELECT `regions`.* FROM `regions` WHERE `regions`.`country_id` = 1[0m
[1m[35mCACHE (0.0ms)[0m SELECT `regions`.* FROM `regions` WHERE `regions`.`country_id` = 1
Rendered shared/_drop.html.erb (30.8ms)
Rendered shared/_drops.html.erb (2.6ms)
Rendered shared/_age_warning.html.erb (1.8ms)
Rendered messages/_form.html.erb (14.4ms)
Rendered offers/_form.html.erb (6.9ms)
[1m[36mType Load (0.2ms)[0m [1mSELECT `types`.* FROM `types`[0m
Rendered feedbacks/_form.html.erb (20.9ms)
Rendered shared/_login.html.erb (0.7ms)
Completed 200 OK in 680ms (Views: 503.5ms | ActiveRecord: 58.1ms)
然后在Chrome控制台中,我收到以下消息: 无法加载资源:服务器响应状态为500(内部服务器错误)
我做错了什么?
感谢。