Announcements

Help Wizard

Step 1

NEXT STEP

FAQs

Please see below the most popular frequently asked questions.

Loading article...

Loading faqs...

VIEW ALL

Ongoing Issues

Please see below the current ongoing issues which are under investigation.

Loading issue...

Loading ongoing issues...

VIEW ALL

Glitch in the header for getting access token?

Solved!

Glitch in the header for getting access token?

Country

Egypt

Device

iPhone 16 Pro Max Simulator (XCode)

Operating System

Sequoia 15.3.1 

 

My Question or Issue

I am a fresh iOS developer(So please be easy on me if I am wrong), I was trying to follow a tutorial however, I noticed something I am not sure if it is a bug or that's how it should be however in this code: 

var request = URLRequest(url: url)

        request.httpMethod = "POST"

        request.setValue("application/x-www-form-urlencoded.", forHTTPHeaderField: "Content-Typ")

I had the "application/x-www-form-urlencoded." with the extra "."

And a typo in the header as it was missing the "e". However, it still worked just fine.

When I added an "e" and kept the "." as in :

request.setValue("application/x-www-form-urlencoded.", forHTTPHeaderField: "Content-Type")

it failed as it was in an incorrect format

However, if I remove the "."  and add the "e" it works just fine 

request.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")

 

I am not sure if there is something I am unaware but I am kinda suspicious that it is not how it should work no?

Reply

Accepted Solutions
Marked as solution

OK nvm, I figured out this is normal after I asked a back-end friend and he explained what's going on, not sure how to delete a post here.
Here, but Yes a false flag sorry

View solution in original post

1 Reply
Marked as solution

OK nvm, I figured out this is normal after I asked a back-end friend and he explained what's going on, not sure how to delete a post here.
Here, but Yes a false flag sorry

Suggested posts