Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Bug in network.request (tested on Parse)
Started by ubj3d.android Dec 30 2015 02:51 PM

8 replies to this topic

Best Answer ubj3d.android , 04 January 2016 - 01:22 PM

Hi Joshua, thank you for your help.

 

That was it!

When I removed the "content-type", no error.

 

In my defense, I was very close to the solution.

I started with examining the mod_parse module, and there for the parse.login, body was used and the "content-type" in headers.

 

I searched the net and found that GET should not have a body, so I removed it, but the error was still there.

 

As mod_parse works on all other platforms I have tested, I assumed that the bug is on your side.

 

Seems that Windows is much more strict in HTTP calls.

 

Once again, thank you VERY MUCH for the help.

 

This will for sure help Windows Phone developers.

[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

ubj3d.android

[GLOBAL: userInfoPane.html]
ubj3d.android
  • Contributor

  • 741 posts
  • Corona SDK

local function networkListener( event )

   if ( event.isError ) then
     print( "error")
   else
     print ( "RESPONSE: " .. event.response )
   end
end

local headers = {}
headers["X-Parse-Application-Id"] = "my key here"
headers["X-Parse-REST-API-Key"] = "my key2 here"
headers["Content-Type"] = "application/json" 

local params = {} 
params.headers = headers
network.request( "https://api.parse.com/1/config", "GET", networkListener, params )

Corona team, please try this code on some Windows Phone (using CoronaCards).

 

It will give you this:

 

A request with this method cannot have a request body.
 
And the event table looks like this:
 
table: 095D3C08 {
  [name] => "networkRequest"
  [isError] => true
  [bytesTransferred] => 0
  [phase] => "ended"
  [bytesEstimated] => 0
  [requestId] => userdata: 00000008
}

 

You don't need to create an app on Parse, because I get the same error even if I do not provide the right keys. Obviously, the error triggers before it gets to Parse verification.

 

I have tried some network.request without custom headers and that works.

 

Hopefully, this is enough info to help you find the bug.



[TOPIC: post.html]
#2

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,895 posts
  • Enterprise

Corona Engineers can't track bugs in the forums. You will need to find a bug report using the "Report a bug" link at the top of the page. Your bug report requires a complete, buildable project; that is a main.lua, build.settings, config.lua and any resources needed to build. Please provide the minimal code that demonstrates the problem.

 

Thanks

Rob



[TOPIC: post.html]
#3

ubj3d.android

[GLOBAL: userInfoPane.html]
ubj3d.android
  • Contributor

  • 741 posts
  • Corona SDK

I am sure your Engineers have some Windows Phone projects ready.

All they need to do is paste this code in the main.lua and call it.

 

I have lost a enough time on this.

 

Thank you.



[TOPIC: post.html]
#4

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,895 posts
  • Enterprise

I'm sorry you feel this way. I don't know what other suggestions I can offer you at this point. If you refuse to submit the bug report, there isn't much our engineers can do.

 

Rob



[TOPIC: post.html]
#5

ubj3d.android

[GLOBAL: userInfoPane.html]
ubj3d.android
  • Contributor

  • 741 posts
  • Corona SDK

Hi Rob,

 

thank you very much for trying to help.

 

But this is not a super complicated case. 

Is is a very simple REST call.

 

I am sure the Engineers will take a look if you whisper to them:

 

"Hey guys, seems we have a bug in REST call with GET and custom headers for Windows Phone" ;)



[TOPIC: post.html]
#6

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,895 posts
  • Enterprise

We have to have a bug report. It's happened so many times where we take your forum code and simply pop it in an existing test app and we can't find the problem because there is something else causing the problem. If this bug is important to you, please take the time and file a bug report. We can't guess at what's going on. We have been burned by this too many times and end up wasting too much time trying to guess at your setup.

 

In fact, if it's as simple as you say, consider the time we've been going back and forth about this. You could have filed the bug already and I could have an engineer looking at it already. Now you're looking at next week at the earliest.

 

Rob



[TOPIC: post.html]
#7

Joshua Quick

[GLOBAL: userInfoPane.html]
Joshua Quick
  • Moderator

  • 3,397 posts
  • Corona Staff

I think it's an issue with your "content-type" header.  It doesn't make any sense to add that to your headers table since a "GET" request never pushes any content (ie: there's no body; you're not pushing any JSON data) to the server.  Comment it out.

 

Perhaps you meant to set the "accept" header to "application/json"?

 

Also note that Corona will just blindly push all of your header info (except for content-length) into the HTTP request on all platforms.  It's up to you set up the headers correctly.  In this case, this error message is coming from the WP8 operating system.  It's telling you that "GET" request are not allowed to have content, but you specify a content-type in the header.  This is just Microsoft validating your configuration.



[TOPIC: post.html]
#8

ubj3d.android

[GLOBAL: userInfoPane.html]
ubj3d.android
  • Contributor

  • 741 posts
  • Corona SDK

  Best Answer

Hi Joshua, thank you for your help.

 

That was it!

When I removed the "content-type", no error.

 

In my defense, I was very close to the solution.

I started with examining the mod_parse module, and there for the parse.login, body was used and the "content-type" in headers.

 

I searched the net and found that GET should not have a body, so I removed it, but the error was still there.

 

As mod_parse works on all other platforms I have tested, I assumed that the bug is on your side.

 

Seems that Windows is much more strict in HTTP calls.

 

Once again, thank you VERY MUCH for the help.

 

This will for sure help Windows Phone developers.



[TOPIC: post.html]
#9

Joshua Quick

[GLOBAL: userInfoPane.html]
Joshua Quick
  • Moderator

  • 3,397 posts
  • Corona Staff

Happy to help!




[topic_controls]
[/topic_controls]