草庐IT

post-contentType

全部标签

ios - afnetworking 3.0 迁移 : how to POST with headers and HTTP Body

我正在尝试向youtubeAPI发出一个包含HTTPHeader字段和HTTP正文的POST请求。以前在AFNetworking的2.0版中,我以前是这样做的:NSDictionary*parameters=@{@"snippet":@{@"textOriginal":self.commentToPost.text,@"parentId":self.commentReplyingTo.commentId}};NSString*url=[NSStringstringWithFormat:@"https://www.googleapis.com/youtube/v3/comments?pa

ios - POST 请求未考虑 NSMutableURLRequest 超时间隔

我有以下问题。在使用HTTP方法POST的NSMutableURLRequest上,为连接设置的超时间隔将被忽略。如果互联网连接出现问题(错误的代理、错误的dns),url请求会在大约2-4分钟后失败,但不会出现NSLocalizedDescription="timedout";NSUnderlyingError=ErrorDomain=kCFErrorDomainCFNetworkCode=-1001UserInfo=0x139580"Therequesttimedout.如果使用的http方法是GET,它工作正常。通过https连接是异步。NSURL*url=[NSURLURLWi

ios 使用 HTTP POST 上传图像和文本

感谢阅读。我是iOS新手,我正在尝试使用multi-partformencoding上传图片和文本在iOS中。curl等效是这样的:curl-F"param1=value1"-F"param2=@testimage.jpg""http://some.ip.address:5000/upload"curl上面的命令在JSON.中返回预期的正确响应问题:我不断收到HTTP400请求,这意味着我在编写HTTPPOST正文时做错了。我做了什么:作为引用,我尝试了FlickrAPIiOSapp"POSTsizetoolarge!"和ObjectiveC:Howtouploadimageandte

api - 如何在 flutter 中向 API 服务器发送请求 POST 消息?

我正在使用NAVERAPI检测人脸,所以我必须向API服务器发送POST消息。消息格式如下。[HTTPRequestHeader]POST/v1/vision/faceHTTP/1.1Host:openapi.naver.comContent-Type:multipart/form-data;boundary={boundary-text}X-Naver-Client-Id:{ClientID}X-Naver-Client-Secret:{ClientSecret}Content-Length:96703--{boundary-text}Content-Disposition:form

post - 发送 post 请求时类型 'int' 不是类型转换中类型 'String' 的子类型

发送发布请求时出现奇怪的错误。//thismapispassedtoafunctionfinalMapactivityData={"userId":1,"name":activityName.text,"description":activityDescription.text,"startAt":activityStartAt.text,"endsAt":activityEndAt.text,"lat":_latitude,"long":_longitude,"category":2,"status":"pending"};//thiscodebellowisinsideaasync

flutter - 在 Flutter 中使用 Http Post 上传正文

我正在尝试创建一个http.post请求,它发送一个图像文件和文本。我认为我只是向服务器发送部分请求并被拒绝。我已经在MultiPartForm和下面的方法中尝试过了我已尝试创建发布请求,但出现此错误:未处理的异常:类型“_File”不是类型转换中类型“String”的子类型voidcreatePreferences(Stringphone,StringnickName,StringcustomerType,doubleage,FilecurrentSelfie){//Variablesvaruri=Uri.http('10.0.2.2:8000','/api/customer/cre

json - 如何在 Flutter 的 POST 请求中将 Map 作为 String 发送?

有一个现成的后端和一个工作请求的例子。但是我无法使用dio或http.post发送正确的发布请求。voidpostOrder(Datumbasket)async{finalprefs=awaitSharedPreferences.getInstance();finalmyUrl=prefs.getString('portal_url')??null;finalMapproductMap={"item_id":basket.id,"shop_id":basket.shopId,"unit_price":basket.unitPrice,"discount_percent":basket.

post - Flutter - 处理POST请求中的状态码302

我正在尝试使用DIO包在Flutter中发送一个post请求。请求如下:getSessionId()async{varcsrf=awaitgetCsrftoken();vardio=newDio(newOptions(baseUrl:"http://xxxxxxx/accounts/login/",connectTimeout:5000,receiveTimeout:100000,//5sheaders:{'Cookie':"csrftoken="+csrf},contentType:ContentType.JSON,//TransformtheresponsedatatoaStrin

http - 使用 JSON 数组的 Flutter POST

我需要使用包含数组的JSON创建发布请求。http.post方法只接受Map.因此,我无法传递类型的map。因为map将包含一个列表。这是我的显式HttpClientRequest代码:StringjsonString=json.encode(body);//encodemaptojsonListbodyBytes=utf8.encode(jsonString);//utf8encodeHttpClientclient=newHttpClient();HttpClientRequestrequest=awaitclient.postUrl(uri);//it'spolitetosend

Dart - 如何对不同主体的多个 http.post 请求

我找到了这个:OptimalwaytomakemultipleindependentrequeststoserverinDart但我的问题有点不同。我想用不同的主体发布多个帖子,但我得到相同的结果,这与类型列表的最后一个元素有关。finalListtypes=['completed','approval','process','available'];想想这个列表,我总是得到“完成”类型的结果。Future>fetchAllRequests()async{inti=0;userInfo['type']=types.first;returnFuture.wait(types.map((t