我有一个发送字节数组的简单客户端:
var content = new ByteArrayContent(wav);
httpClient.PostAsync(@"http://localhost:12080/api/values", content);
Run Code Online (Sandbox Code Playgroud)
和一个接收该帖子请求的简单服务器:
[HttpPost]
public string Post([FromBody]byte[] parms)
{
//bla bla
}
Run Code Online (Sandbox Code Playgroud)
问题是我null作为传入参数获取.
你知道这可能是什么问题吗?
我正在使用带有Bootstrap的Rails 4和Simple Form。
我希望我的复选框不会像这样:
<%= c.input :my_bool_field, label: false, class: "form-control" %>
Run Code Online (Sandbox Code Playgroud)
但类似的东西(我有CSS)
<label class="switch switch-primary">
<input type="checkbox" />
<span></span>
</label>
Run Code Online (Sandbox Code Playgroud)
我知道我可以使用simple_form包装器,但是我发现它们有些混乱。有人可以帮我用这种样式创建复选框吗?
我正在尝试使用以下 HTTP 请求创建新的广告创意
response = HTTParty.post(
"https://graph.facebook.com/v2.9/act_#{account_id}/adcreatives",
:query => {
:ad_format => "DESKTOP_FEED_STANDARD",
:access_token => @ads_access_token,
:creative => {
:object_story_spec => {
:object_id => page_id,
:link_data => {
:call_to_action => {
:type => ad_cta,
:value => {
:link => ad_url
}
},
:link => ad_url,
:message => ad_text,
:description => ad_description,
:name => ad_headline,
:picture => ad_image_url
},
:page_id => "233558376717908"
}
}
}
)
Run Code Online (Sandbox Code Playgroud)
但不幸的是,我不断收到以下错误:
{"error"=>
{"message"=>"Invalid parameter",
"type"=>"OAuthException",
"code"=>100,
"error_subcode"=>1487930,
"is_transient"=>false,
"error_user_title"=>"Promoted Object Is Missing",
"error_user_msg"=>
"Your campaign …Run Code Online (Sandbox Code Playgroud) facebook facebook-graph-api facebook-javascript-sdk facebook-marketing-api
我正在使用HttpContext.Current.Server.MapPath函数来查找IIS托管的站点中的资源.
HttpContext.Current.Server.MapPath("localPath")
Run Code Online (Sandbox Code Playgroud)
我从中获得的价值是:
c:\users\guy\documents\visual studio 2012\Projects\MyProject\MyProject\api\localPath
而真正的内容是在
C:\Users\guy\Documents\Visual Studio 2012\Projects\MyProject\MyProject\localPath
为什么我api最终得到一个额外的?也许这与我运行webapi应用程序的事实有关?
谢谢.