Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8466631
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T15:23:53+00:00 2026-06-10T15:23:53+00:00

The documentation for AFNetworking notes that you should create subclass of AFHTTPClient and use

  • 0

The documentation for AFNetworking notes that you should create subclass of AFHTTPClient and use it as a singleton per web-service.

If I have 2 endpoints at http://www.example.com, one that allows for ‘application/json’ in HTTP_ACCEPT and another that needs text/html, what parameter would I configure in my singleton AFHTTPClient class so that it configures the correct HTTP_ACCEPT value?

Implementation details:

@interface MyAFHTTPClient : AFHTTPClient
+ (MyAFHTTPClient *)sharedClient;
@end

[[MyAFHTTPClient sharedClient] getPath:@"endPoint_json"
                                     parameters:nil 
                                        success:^(AFHTTPRequestOperation *operation, id responseObject) {
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
}]

At a later time, I need to invoke the html endpoint:

[[MyAFHTTPClient sharedClient] getPath:@"endPoint_html"
                                     parameters:nil 
                                        success:^(AFHTTPRequestOperation *operation, id responseObject) {
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
}]

It seems that both of these calls cause "HTTP_ACCEPT"=>"application/json" when the server receives the request.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T15:23:55+00:00Added an answer on June 10, 2026 at 3:23 pm

    getPath:... and all of those convenience methods construct a request with requestWithMethod:path:parameters:, and then pass that into HTTPRequestOperationWithRequest:success:failure:, which is then enqueued into an operation queue.

    If you need to do a one-off request for HTML or the like, do these steps manually rather than using the convenience method: create the request, set the Accept (HTTP_ACCEPT) is not an HTTP header) header to text/html, and then create and enqueue the operation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Documentation states that You must use /EHa when using _set_se_translator.. My question is: should
Per documentation, Doctrine_Record after saving should set id of newly created record as object
The documentation for MFMessageComposeViewController says you should check [MFMessageComposeViewController canSendText] before trying to create
Documentation says that waypoints limit is 8 points. But I have to draw a
The documentation of System.Threading.Timer says that I should keep a live reference for it
The documentation for Access.BackingField() indicates that this: Sets the access-strategy to use the backing-field
Documentation says that waypoints limit is 8 points. But I have to calculate a
The documentation for the method getItemPosition in Android's PagerAdapter class states that it is:
Documentation states that interface delegation is available for Win32 only. Currently I can't test
The documentation for NSDictionary says that the method objectForKey returns nil if the NSDictionary

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.